Add NOINLINE pragmas ahead of desugaring #2340
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Liquid Haskell needs to preserve the local bindings so they can have specs attached. The desugarer, however, might inline these local bindings if they look trivial enough.
The way that LH prevented inlining so far is by inserting breakpoints by enabling -fbreak-points. Apparently, the desugarer is more conservative with it. But it also made LH depend on a side effect of break points that could change at any time.
In this PR, LH is inserting NOINLINE pragmas for all local bindings. This allows to stop using break points in most tests, and it declares more explicitly what LH needs from the desugarer.
The story does not end here, because when inserting break points, the desugarer is also more conservative in other aspects that matter to LH. The aspect I identified is the introduction of auxiliary bindings when desugaring. I discussed examples of this in #2325.
Going without breakpoints prompted some work on Core transformations after desugaring that went in #2337 and #2338, so these transformation could handle the auxiliary bindings that desugaring started producing.
In the end, only a couple of modules in the bytestring benchmark need desugaring with breakpoints. For now, I'm leaving breakpoints enabled because I think they help produce Core that is easier for LH.
I'm adding, however, a flag
--insert-core-break-points
that can be used to disable insertion of breakpoints withThis allows to reproduce the failure in the bytestring benchmark without having to recompile, and it may be handy when debugging other desugaring problems.