Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NOINLINE pragmas ahead of desugaring #2340

Merged
merged 3 commits into from
Sep 18, 2024
Merged

Conversation

facundominguez
Copy link
Collaborator

@facundominguez facundominguez commented Sep 17, 2024

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 with

{-@ LIQUID "--insert-core-break-points=false" @-}

This allows to reproduce the failure in the bytestring benchmark without having to recompile, and it may be handy when debugging other desugaring problems.

@facundominguez facundominguez merged commit c746626 into develop Sep 18, 2024
4 checks passed
@facundominguez facundominguez deleted the fd/noinline4 branch September 18, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant