Commit 88a6f863 authored by Simon Marlow's avatar Simon Marlow

Small optimisation: always sink/inline reg1 = reg2 assignments

parent a7e0d448
......@@ -178,7 +178,7 @@ cmmSink dflags graph = ofBlockList (g_entry graph) $ sink mapEmpty $ blocks
drop_if a@(r,rhs,_) live_sets = (should_drop, live_sets')
where
should_drop = conflicts dflags a final_last
|| {- not (isSmall rhs) && -} live_in_multi live_sets r
|| not (isTrivial rhs) && live_in_multi live_sets r
|| r `Set.member` live_in_joins
live_sets' | should_drop = live_sets
......@@ -205,12 +205,12 @@ isSmall (CmmLit _) = True
isSmall (CmmMachOp (MO_Add _) [x,y]) = isTrivial x && isTrivial y
isSmall (CmmRegOff (CmmLocal _) _) = True
isSmall _ = False
-}
isTrivial :: CmmExpr -> Bool
isTrivial (CmmReg (CmmLocal _)) = True
isTrivial (CmmLit _) = True
-- isTrivial (CmmLit _) = True
isTrivial _ = False
-}
--
-- annotate each node with the set of registers live *after* the node
......@@ -365,9 +365,8 @@ tryToInline dflags live node assigs = go usages node [] assigs
go _usages node _skipped [] = (node, [])
go usages node skipped (a@(l,rhs,_) : rest)
| can_inline = inline_and_discard
| False {- isTiny rhs -} = inline_and_keep
-- ^^ seems to make things slightly worse
| can_inline = inline_and_discard
| isTrivial rhs = inline_and_keep
where
inline_and_discard = go usages' node' skipped rest
......
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