Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3513b073665784ef9c6c8c71284074fa583fafcd

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

commit 3513b073665784ef9c6c8c71284074fa583fafcd
Author: Edward Z. Yang <[email protected]>
Date:   Fri Jun 17 19:01:36 2011 +0100

    Skip constant folding in nativegen if new codegen used.
    
    Signed-off-by: Edward Z. Yang <[email protected]>

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

 compiler/nativeGen/AsmCodeGen.lhs |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/nativeGen/AsmCodeGen.lhs 
b/compiler/nativeGen/AsmCodeGen.lhs
index abf9d73..1ea83e8 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -891,8 +891,14 @@ cmmStmtConFold stmt
            -> return other
 
 cmmExprConFold :: ReferenceKind -> CmmExpr -> CmmOptM CmmExpr
--- ToDo: Allow for a flag to turn off invocation of cmmExprCon -- EZY
-cmmExprConFold referenceKind expr = cmmExprNative referenceKind (cmmExprCon 
expr)
+cmmExprConFold referenceKind expr = do
+    dflags <- getDynFlagsCmmOpt
+    -- Skip constant folding if new code generator is running
+    -- (this optimization is done in Hoopl)
+    let expr' = if dopt Opt_TryNewCodeGen dflags
+                    then expr
+                    else cmmExprCon expr
+    cmmExprNative referenceKind expr'
 
 cmmExprCon :: CmmExpr -> CmmExpr
 cmmExprCon (CmmLoad addr rep) = CmmLoad (cmmExprCon addr) rep



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to