diff options
-rw-r--r-- | compiler/GHC/Cmm/Pipeline.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Driver/Flags.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 2 | ||||
-rw-r--r-- | docs/users_guide/using-optimisation.rst | 12 |
4 files changed, 15 insertions, 2 deletions
diff --git a/compiler/GHC/Cmm/Pipeline.hs b/compiler/GHC/Cmm/Pipeline.hs index 481f2bb545..7de0ce0cb8 100644 --- a/compiler/GHC/Cmm/Pipeline.hs +++ b/compiler/GHC/Cmm/Pipeline.hs @@ -142,7 +142,7 @@ cpsTop logger platform dflags proc = ----------- Control-flow optimisations ----------------------------- g <- {-# SCC "cmmCfgOpts(2)" #-} - return $ if optLevel dflags >= 1 + return $ if gopt Opt_CmmControlFlow dflags then map (cmmCfgOptsProc splitting_proc_points) g else g g <- return (map removeUnreachableBlocksProc g) diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 341851c81b..e7205a8620 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -212,6 +212,7 @@ data GeneralFlag | Opt_CmmSink | Opt_CmmStaticPred | Opt_CmmElimCommonBlocks + | Opt_CmmControlFlow | Opt_AsmShortcutting | Opt_OmitYields | Opt_FunToThunk -- allow GHC.Core.Opt.WorkWrap.Utils.mkWorkerArgs to remove all value lambdas diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 7c5d0c71a5..e4c86e94c9 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -3376,6 +3376,7 @@ fFlagsDeps = [ flagSpec "alignment-sanitisation" Opt_AlignmentSanitisation, flagSpec "num-constant-folding" Opt_NumConstantFolding, flagSpec "fast-pap-calls" Opt_FastPAPCalls, + flagSpec "cmm-control-flow" Opt_CmmControlFlow, flagSpec "show-warning-groups" Opt_ShowWarnGroups, flagSpec "hide-source-paths" Opt_HideSourcePaths, flagSpec "show-loaded-modules" Opt_ShowLoadedModules, @@ -3854,6 +3855,7 @@ optLevelFlags -- see Note [Documenting optimisation flags] , ([1,2], Opt_CSE) , ([1,2], Opt_StgCSE) , ([2], Opt_StgLiftLams) + , ([1,2], Opt_CmmControlFlow) , ([1,2], Opt_EnableRewriteRules) -- Off for -O0. Otherwise we desugar list literals diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 6d33c5b5bc..5fa9a81a5e 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -227,6 +227,17 @@ by saying ``-fno-wombat``. loops and hot code paths. This information is then used by the register allocation and code layout passes. +.. ghc-flag:: -fcmm-control-flow + :shortdesc: Enable control flow optimisation in the Cmm backend. Implied by :ghc-flag:`-O`. + :type: dynamic + :reverse: -fno-cmm-control-flow + :category: + + :default: on + + Enables some control flow optimisations in the Cmm code + generator, merging basic blocks and avoiding jumps right after jumps. + .. ghc-flag:: -fasm-shortcutting :shortdesc: Enable shortcutting on assembly. Implied by :ghc-flag:`-O2`. :type: dynamic @@ -1554,4 +1565,3 @@ by saying ``-fno-wombat``. This flag sets the size (in bytes) threshold above which the second approach is used. You can disable the second approach entirely by setting the threshold to 0. - |