summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmSink.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-09-21 11:05:53 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-09-24 09:51:58 +0100
commitacdebbbad25f6d9c5c11550cc8998db10b8b8a48 (patch)
treed5f422757b96192383cf1b189bbe6b42e15f56d2 /compiler/cmm/CmmSink.hs
parent0b79d5cd4687dacf7efd430df7fba9d9a5a5ce32 (diff)
downloadhaskell-acdebbbad25f6d9c5c11550cc8998db10b8b8a48.tar.gz
no functional changes
Diffstat (limited to 'compiler/cmm/CmmSink.hs')
-rw-r--r--compiler/cmm/CmmSink.hs23
1 files changed, 16 insertions, 7 deletions
diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs
index 8c5c99d469..28e3b7723d 100644
--- a/compiler/cmm/CmmSink.hs
+++ b/compiler/cmm/CmmSink.hs
@@ -155,7 +155,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 (isTiny rhs) && -} live_in_multi live_sets r
+ || {- not (isSmall rhs) && -} live_in_multi live_sets r
|| r `Set.member` live_in_joins
live_sets' | should_drop = live_sets
@@ -172,12 +172,21 @@ cmmSink dflags graph = ofBlockList (g_entry graph) $ sink mapEmpty $ blocks
mapFromList [ (l, filterAssignments dflags (getLive l) assigs'')
| l <- succs ]
-{-
--- tiny: an expression we don't mind duplicating
-isTiny :: CmmExpr -> Bool
-isTiny (CmmReg _) = True
-isTiny (CmmLit _) = True
-isTiny _other = False
+{- TODO: enable this later, when we have some good tests in place to
+ measure the effect and tune it.
+
+-- small: an expression we don't mind duplicating
+isSmall :: CmmExpr -> Bool
+isSmall (CmmReg (CmmLocal _)) = True -- not globals, we want to coalesce them instead
+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 _ = False
-}
--