Join points, casts & ticks: approach in Core Prep
Tickets:
- #14242 (closed), #26157, #26642 (closed), #26693 (closed): join points under profiling ticks
- #14610, #21716 (closed), #26422: join points under casts
This is a variant on !14929 (closed) with the alternative implementation strategy suggested by @simonpj in !14929 (comment 658333), where we recover join-point-hood in Core Prep.
Changes:
-
Remove
GHC.Types.Tickish.TickishScopingin favour of simpler predicatestickishHasNoScope/tickishHasSoftScope, closer to how things were before commit 993975d3. This makes the code easier to read and document (fewer indirections). -
Introduce
canCollectArgsThroughTickfor consistent handling of ticks aroundPrimOps and otherIds that cannot be eta-reduced. See overhauled Note [Ticks and mandatory eta expansion]. -
New Note [JoinId vs TailCallInfo] in
GHC.Core.SimpleOptthat explains robustness ofJoinIdvs fragility ofTailCallInfo. -
Allow casts/non-soft-scoped ticks to occur in between a join point binder and a jump, but only in Core Prep. See Note [Join points, casts, and ticks] and Note [Join points, casts, and ticks... in Core Prep] in
GHC.Core.Opt.Simplify.Iteration.Also update Core Lint to account for this. See Note [Linting join points with casts or ticks] in
GHC.Core.Lint. -
Update
GHC.Core.Utils.mergeCaseAltsto avoid pushing a cast in between a join point binding and its jumps. This fixes #26642 (closed). See the new (MC5) and (MC6) in Note [Merge Nested Cases].