Commit 3ae875c4 authored by Simon Marlow's avatar Simon Marlow

Eliminate "r = r" assignments.

Previously these were caught by removeDeadAssignments, but we aren't
doing that now.
parent 95686360
......@@ -205,7 +205,12 @@ walk nodes assigs = go nodes emptyBlock assigs
-- to get all the dead code, but it catches the common case of
-- superfluous reloads from the stack that the stack allocator
-- leaves behind.
--
-- Also we catch "r = r" here. You might think it would fall
-- out of inlining, but the inliner will see that r is live
-- after the instruction and choose not to inline r in the rhs.
discard = case node of
CmmAssign r (CmmReg r') | r == r' -> True
CmmAssign (CmmLocal r) _ -> not (r `Set.member` live)
_otherwise -> False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment