Don't try and coalesce nodes with themselves
[ghc-hetmet.git] / compiler / nativeGen / RegLiveness.hs
index 5f8db17..b55d8c0 100644 (file)
@@ -283,7 +283,10 @@ slurpReloadCoalesce live
                -- add an edge betwen the this reg and the last one stored into the slot
                | RELOAD slot reg       <- instr
                = case lookupUFM slotMap slot of
-                       Just reg2       -> (slotMap, Just (reg, reg2))
+                       Just reg2
+                        | reg /= reg2  -> (slotMap, Just (reg, reg2))
+                        | otherwise    -> (slotMap, Nothing)
+
                        Nothing         -> (slotMap, Nothing)
 
                | otherwise