[Git][ghc/ghc][wip/mangoiv/27556] simplifier: allow more ticks in argument position in rebuild_app
Magnus pushed to branch wip/mangoiv/27556 at Glasgow Haskell Compiler / GHC Commits: 426c4b22 by mangoiv at 2026-08-24T16:06:55+02:00 simplifier: allow more ticks in argument position in rebuild_app In cpeApp, GHC asserted that all argument ticks were profiling ticks. 08bc245be70d95801bc1138804ed1de9474fbdc0 allows more liberal floating of ticks, which in combination with the right ticks, in this case Breakpoint ticks, which will float during optimizations when optimized bytecode is enabled, surfaced the fact that this assert is too strict. Now, we allow all ticks that have `tickishPlace` PlaceRuntime and don't assert. Fixes #27556 - - - - - 6 changed files: - + changelog.d/27556 - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Types/Tickish.hs - + testsuite/tests/simplCore/should_compile/T27556.hs - + testsuite/tests/simplCore/should_compile/T27556.script - testsuite/tests/simplCore/should_compile/all.T Changes: ===================================== changelog.d/27556 ===================================== @@ -0,0 +1,5 @@ +section: compiler +synopsis: Remove a too strict assert in coreprep; fixes a bug where debug builds + of GHC would fail to compile correctly optimized programs. +mrs: !16558 +issues: #27556 ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1260,10 +1260,9 @@ cpeApp top_env expr -- See Note [Ticks and mandatory eta expansion] AITick tickish - | tickishPlace tickish == PlaceRuntime + | PlaceRuntime <- tickishPlace tickish , req_depth > 0 - -> assert (isProfTick tickish) $ - rebuild_app' env as fun' floats ss (tickish:rt_ticks) req_depth + -> rebuild_app' env as fun' floats ss (tickish:rt_ticks) req_depth | otherwise -- See [Floating Ticks in CorePrep] -> rebuild_app' env as fun' (snocFloat floats (FloatTick tickish)) ss rt_ticks req_depth ===================================== compiler/GHC/Types/Tickish.hs ===================================== @@ -13,7 +13,6 @@ module GHC.Types.Tickish ( mkNoCount, mkNoScope, tickishIsCode, - isProfTick, TickishPlacement(..), tickishPlace, tickishContains, @@ -545,10 +544,6 @@ tickishIsCode ProfNote{} = True tickishIsCode Breakpoint{} = True tickishIsCode HpcTick{} = True -isProfTick :: GenTickish pass -> Bool -isProfTick ProfNote{} = True -isProfTick _ = False - -- | Governs the kind of expression that the tick gets placed on when -- annotating for example using @mkTick@. If we find that we want to -- put a tickish on an expression ruled out here, we try to float it ===================================== testsuite/tests/simplCore/should_compile/T27556.hs ===================================== @@ -0,0 +1,4 @@ +import Control.Exception + +main = mask $ \restore -> restore (pure ()) + ===================================== testsuite/tests/simplCore/should_compile/T27556.script ===================================== @@ -0,0 +1 @@ +:l T27556 ===================================== testsuite/tests/simplCore/should_compile/all.T ===================================== @@ -611,3 +611,4 @@ test('T27296', [], makefile_test, ['T27296']) test('T27296b', [], makefile_test, ['T27296b']) test('T27589', [grep_errmsg(r'wombat')], compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-uniques']) test('T27590', [grep_errmsg(r'wombat')], compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-uniques']) +test('T27556', [only_ways('ghci'), extra_hc_opts('-O -fno-unoptimized-core-for-interpreter')], ghci_script, ['T27556.script']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/426c4b222fe308650b4679a6013d4406... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/426c4b222fe308650b4679a6013d4406... 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)
-
Magnus (@MangoIV)