Skip to content

Fix #20959

Ben Gamari requested to merge wip/T20959 into master

When generating an SRT for a recursive group, GHC.Cmm.Info.Build.oneSRT filters out recursive references, as described in Note [recursive SRTs]. However, doing so for static functions would be unsound, for the reason described in Note [Invalid optimisation: shortcutting].

As we discovered in #20959 (closed), this same argument applies to static data constructor applications. Fix this by ensuring that static data constructor applications are included in recursive SRTs.

The approach here is not entirely satisfactory, but it is a starting point.

In addition I try to clean up and elaborate the comments in GHC.Cmm.Info.Build, hopefully making this module a bit easier to understand. The fix for #20959 (closed) is entirely contained in the last commit of the branch.

Todo

  • Decide whether this approach is acceptable or whether further refactoring is necessary
  • Finish documenting the status quo
  • Try again to find a crashing minimal testcase
Edited by Ben Gamari

Merge request reports