[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: 0c73f75d by mangoiv at 2026-08-21T09:54:44+02:00 simplifier: allow more ticks in argument position in rebuild_app In cpeApp, we were carefully asserting that all argument ticks were profiling ticks. This was too strict as we allow any non-floatable tick in that position, which is described in Note [Ticks and mandatory eta expansion]. When `canCollectArgsThrougTick` was introduced, the rules for ticks in argument positions became more lenient, for instance, it was not a necessary precondition for the Id to have no binding, which simply allowed more ticks to float to that position. The test demonstrates that; with optimized bytecode, a breakpoint tick appears and takes as argument a primop that has to be eta expanded so we move it out of the way. Fixes #27556 - - - - - 5 changed files: - + changelog.d/27556 - compiler/GHC/CoreToStg/Prep.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,4 @@ +section: compiler +synopsis: Remove a too strict assert in coreprep +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 ===================================== 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/0c73f75dfcee0a6267808048e7026572... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c73f75dfcee0a6267808048e7026572... 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)