[Git][ghc/ghc][master] compiler: fix missing top-level procedure labels in cmm dumps
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 90e95b34 by Cheng Shao at 2026-07-29T06:40:45-04:00 compiler: fix missing top-level procedure labels in cmm dumps This patch fixes missing top-level procedure labels in some intermediate Cmm pass dumps. Fixes #27553. Co-authored-by: Codex <codex@openai.com> - - - - - 2 changed files: - + changelog.d/fix-cmm-dump-labels - compiler/GHC/Cmm/Pipeline.hs Changes: ===================================== changelog.d/fix-cmm-dump-labels ===================================== @@ -0,0 +1,4 @@ +section: compiler +synopsis: Fix missing top-level procedure labels in some intermediate Cmm pass dumps. +issues: #27553 +mrs: !16406 ===================================== compiler/GHC/Cmm/Pipeline.hs ===================================== @@ -8,6 +8,7 @@ import GHC.Prelude import GHC.Driver.Flags import GHC.Cmm +import GHC.Cmm.CLabel import GHC.Cmm.Config import GHC.Cmm.ContFlowOpt import GHC.Cmm.CommonBlockElim @@ -80,14 +81,14 @@ cpsTop logger platform cfg dus proc = -- CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-} return $ cmmCfgOptsProc splitting_proc_points proc - dump Opt_D_dump_cmm_cfg "Post control-flow optimisations (1)" g + dump Opt_D_dump_cmm_cfg "Post control-flow optimisations (1)" l g let !TopInfo {stack_info=StackInfo { arg_space = entry_off , do_layout = do_layout }} = h ----------- Eliminate common blocks ------------------------------------- g <- {-# SCC "elimCommonBlocks" #-} - condPass (cmmOptElimCommonBlks cfg) elimCommonBlocks g + condPass (cmmOptElimCommonBlks cfg) elimCommonBlocks l g Opt_D_dump_cmm_cbe "Post common block elimination" -- Any work storing block Labels must be performed _after_ @@ -98,7 +99,7 @@ cpsTop logger platform cfg dus proc = then {-# SCC "createSwitchPlans" #-} pure $ runUniqueDSM dus $ cmmImplementSwitchPlans platform g else pure (g, dus) - dump Opt_D_dump_cmm_switch "Post switch plan" g + dump Opt_D_dump_cmm_switch "Post switch plan" l g ----------- ThreadSanitizer instrumentation ----------------------------- g <- {-# SCC "annotateTSAN" #-} @@ -111,7 +112,7 @@ cpsTop logger platform cfg dus proc = return $ initUs_ us $ annotateTSAN platform g else return g - dump Opt_D_dump_cmm_thread_sanitizer "ThreadSanitizer instrumentation" g + dump Opt_D_dump_cmm_thread_sanitizer "ThreadSanitizer instrumentation" l g ----------- Proc points ------------------------------------------------- let @@ -134,11 +135,11 @@ cpsTop logger platform cfg dus proc = if do_layout then runUniqueDSM dus $ cmmLayoutStack cfg proc_points entry_off g else ((g, mapEmpty), dus) - dump Opt_D_dump_cmm_sp "Layout Stack" g + dump Opt_D_dump_cmm_sp "Layout Stack" l g ----------- Sink and inline assignments -------------------------------- g <- {-# SCC "sink" #-} -- See Note [Sinking after stack layout] - condPass (cmmOptSink cfg) (cmmSink platform) g + condPass (cmmOptSink cfg) (cmmSink platform) l g Opt_D_dump_cmm_sink "Sink assignments" ------------- CAF analysis ---------------------------------------------- @@ -182,11 +183,11 @@ cpsTop logger platform cfg dus proc = dumps flag name = mapM_ (dumpWith logger flag name FormatCMM . pdoc platform) - condPass do_opt pass g dumpflag dumpname = + condPass do_opt pass lbl g dumpflag dumpname = if do_opt then do g <- return $ pass g - dump dumpflag dumpname g + dump dumpflag dumpname lbl g return g else return g @@ -359,10 +360,10 @@ generator later. -} -dumpGraph :: Logger -> Platform -> Bool -> DumpFlag -> String -> CmmGraph -> IO () -dumpGraph logger platform do_linting flag name g = do +dumpGraph :: Logger -> Platform -> Bool -> DumpFlag -> String -> CLabel -> CmmGraph -> IO () +dumpGraph logger platform do_linting flag name lbl g = do when do_linting $ do_lint g - dumpWith logger flag name FormatCMM (pdoc platform g) + dumpWith logger flag name FormatCMM (pdoc platform lbl $$ pdoc platform g) where do_lint g = case cmmLintGraph platform g of Just err -> do { fatalErrorMsg logger err View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/90e95b34043c54351556ddee013e2d54... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/90e95b34043c54351556ddee013e2d54... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Marge Bot (@marge-bot)