Skip to content

Join points, casts & ticks: approach in Core Prep

sheaf requested to merge sheaf/ghc:join-point-ticks into master

Tickets:

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.TickishScoping in favour of simpler predicates tickishHasNoScope/tickishHasSoftScope, closer to how things were before commit 993975d3. This makes the code easier to read and document (fewer indirections).

  • Introduce canCollectArgsThroughTick for consistent handling of ticks around PrimOps and other Ids that cannot be eta-reduced. See overhauled Note [Ticks and mandatory eta expansion].

  • New Note [JoinId vs TailCallInfo] in GHC.Core.SimpleOpt that explains robustness of JoinId vs fragility of TailCallInfo.

  • 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.mergeCaseAlts to 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].

Edited by sheaf

Merge request reports

Loading