[Git][ghc/ghc][wip/mangoiv/27556] simplifier: remove a bogus `assert` in `rebuild_app'` in `GHC.CoreToStg.Prep.cpeApp`.
Magnus pushed to branch wip/mangoiv/27556 at Glasgow Haskell Compiler / GHC Commits: b4a6c9df by mangoiv at 2026-09-02T14:27:21+02:00 simplifier: remove a bogus `assert` in `rebuild_app'` in `GHC.CoreToStg.Prep.cpeApp`. Prior to this commit commit 08bc245be70d95801bc1138804ed1de9474fbdc0 Author: sheaf <sam.derbyshire@gmail.com> Date: Sat Feb 28 16:30:43 2026 +0100 Clean up join points, casts & ticks This commit shores up the logic dealing with casts and ticks occurring in between a join point binding and a jump any `PlaceRuntime` ticks we observed were profiling ticks, even though that isn't necessary. The more liberal rules in the above commit allow e.g. breakpoint ticks (which are valid PlaceRuntime ticks) to legitimately appear in an argument position. 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/b4a6c9dfc295ee7f64d3a5eb918809b3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b4a6c9dfc295ee7f64d3a5eb918809b3... 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)