summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmPipeline.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-08 16:06:31 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-08-09 09:08:58 +0100
commit74d5ddeec2d02960815232b3bff63d669e6f7c50 (patch)
tree55ef50b1a17b2322163e667eef242a1bd542ca35 /compiler/cmm/CmmPipeline.hs
parent3a5788c7e09fd6fe3986e731efe71a0cbca24b1d (diff)
downloadhaskell-74d5ddeec2d02960815232b3bff63d669e6f7c50.tar.gz
Only run the second round of control-flow optimisations when -O is on
Diffstat (limited to 'compiler/cmm/CmmPipeline.hs')
-rw-r--r--compiler/cmm/CmmPipeline.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs
index f6cbb5c52c..b3b4af712d 100644
--- a/compiler/cmm/CmmPipeline.hs
+++ b/compiler/cmm/CmmPipeline.hs
@@ -55,6 +55,11 @@ cpsTop _ p@(CmmData {}) = return (mapEmpty, [p])
cpsTop hsc_env (CmmProc h@(TopInfo {stack_info=StackInfo {arg_space=entry_off}}) l g) =
do
----------- Control-flow optimisations ----------------------------------
+
+ -- The first round of control-flow optimisation speeds up the
+ -- later passes by removing lots of empty blocks, so we do it
+ -- even when optimisation isn't turned on.
+ --
g <- {-# SCC "cmmCfgOpts(1)" #-}
return $ cmmCfgOpts splitting_proc_points g
dump Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g
@@ -118,7 +123,9 @@ cpsTop hsc_env (CmmProc h@(TopInfo {stack_info=StackInfo {arg_space=entry_off}})
----------- Control-flow optimisations -----------------------------
gs <- {-# SCC "cmmCfgOpts(2)" #-}
- return $ map (cmmCfgOptsProc splitting_proc_points) gs
+ return $ if optLevel dflags >= 1
+ then map (cmmCfgOptsProc splitting_proc_points) gs
+ else gs
dumps Opt_D_dump_cmmz_cfg "Post control-flow optimsations" gs
return (cafEnv, gs)
@@ -134,7 +141,9 @@ cpsTop hsc_env (CmmProc h@(TopInfo {stack_info=StackInfo {arg_space=entry_off}})
----------- Control-flow optimisations -----------------------------
g <- {-# SCC "cmmCfgOpts(2)" #-}
- return $ cmmCfgOptsProc splitting_proc_points g
+ return $ if optLevel dflags >= 1
+ then cmmCfgOptsProc splitting_proc_points g
+ else g
dump' Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g
return (cafEnv, [g])