From 6c2c07c5c98adac365cc3da912ceb209bee41a61 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 18 Jul 2012 13:33:45 +0100 Subject: [PATCH] bugfix: cope when a source reg is dead at a join point We didn't trip over this one until I started generating code without proc-point splitting, which has more join points and loops. --- .../nativeGen/RegAlloc/Linear/JoinToTargets.hs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs b/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs index 3bf49a31f2..c17b65d6e2 100644 --- a/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs +++ b/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs @@ -235,16 +235,10 @@ joinToTargets_again -- makeRegMovementGraph :: RegMap Loc -> RegMap Loc -> [(Unique, Loc, [Loc])] makeRegMovementGraph adjusted_assig dest_assig - = let - mkNodes src vreg - = expandNode vreg src - $ lookupWithDefaultUFM_Directly - dest_assig - (panic "RegAllocLinear.makeRegMovementGraph") - vreg - - in [ node | (vreg, src) <- ufmToList adjusted_assig - , node <- mkNodes src vreg ] + = [ node | (vreg, src) <- ufmToList adjusted_assig + -- source reg might not be needed at the dest: + , Just loc <- [lookupUFM_Directly dest_assig vreg] + , node <- expandNode vreg src loc ] -- | Expand out the destination, so InBoth destinations turn into -- GitLab