Skip to content

Fix contification with stable unfoldings (#22428)

Sebastian Graf requested to merge wip/T22428 into master

Many functions now return a TailUsageDetails that adorns a UsageDetails with a JoinArity that reflects the number of join point binders around the body for which the UsageDetails was computed. TailUsageDetails is now returned by occAnalLamTail as well as occAnalUnfolding and occAnalRules.

I adjusted Note [Join points and unfoldings/rules] and Note [Adjusting right-hand sides] to account for the new machinery. I also wrote a new Note [Join arity prediction based on joinRhsArity] and refer to it when we combine TailUsageDetails for a recursive RHS.

I also renamed

  • occAnalLam to occAnalLamTail
  • adjustRhsUsage to adjustTailUsage
  • a few other less important functions

and properly documented the that each call of occAnalLamTail must pair up with adjustTailUsage.

I removed Note [Unfoldings and join points] because it was redundant with Note [Occurrences in stable unfoldings].

While in town, I refactored mkLoopBreakerNodes so that it returns a condensed NodeDetails called SimpleNodeDetails.

Fixes #22428 (closed).

Edited by Sebastian Graf

Merge request reports