[commit: ghc] master: Small optimisation: always sink/inline reg1 = reg2 assignments (88a6f86)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/88a6f863d9f127fc1b03a1e2f068fd20ecbe096c

>---------------------------------------------------------------

commit 88a6f863d9f127fc1b03a1e2f068fd20ecbe096c
Author: Simon Marlow <[email protected]>
Date:   Tue Oct 23 13:06:17 2012 +0100

    Small optimisation: always sink/inline reg1 = reg2 assignments

>---------------------------------------------------------------

 compiler/cmm/CmmSink.hs |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs
index 688d6f6..ad70b96 100644
--- a/compiler/cmm/CmmSink.hs
+++ b/compiler/cmm/CmmSink.hs
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.