[commit: ghc] newcg: no need to check for unreachable blocks with -fnew-codegen (2491856)

Simon Marlow marlowsd at gmail.com
Wed Jul 4 14:23:47 CEST 2012


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

On branch  : newcg

http://hackage.haskell.org/trac/ghc/changeset/2491856e735c654f7d3a83b516d92ef115287853

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

commit 2491856e735c654f7d3a83b516d92ef115287853
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Jul 3 15:19:15 2012 +0100

    no need to check for unreachable blocks with -fnew-codegen
    
    we've already done it

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

 compiler/nativeGen/AsmCodeGen.lhs |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs
index a8fd604..454dd86 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -857,7 +857,12 @@ cmmToCmm :: DynFlags -> RawCmmDecl -> (RawCmmDecl, [CLabel])
 cmmToCmm _ top@(CmmData _ _) = (top, [])
 cmmToCmm dflags (CmmProc info lbl (ListGraph blocks)) = runCmmOpt dflags $ do
   let platform = targetPlatform dflags
-  blocks' <- mapM cmmBlockConFold (cmmMiniInline platform (cmmEliminateDeadBlocks blocks))
+
+  let reachable_blocks | dopt Opt_TryNewCodeGen dflags = blocks
+                       | otherwise = cmmEliminateDeadBlocks blocks
+      -- The new codegen path has already eliminated unreachable blocks by now
+
+  blocks' <- mapM cmmBlockConFold (cmmMiniInline platform reachable_blocks)
   return $ CmmProc info lbl (ListGraph blocks')
 
 newtype CmmOptM a = CmmOptM (([CLabel], DynFlags) -> (# a, [CLabel] #))





More information about the Cvs-ghc mailing list