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

Don't fold lets with fail, trace or >-> in the body #2973

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

lukaszcz
Copy link
Collaborator

This is to avoid optimizing e.g.

let x := A in
trace "after A" >-> x

into

trace "after A" >-> A

which is annoying when debugging.

@lukaszcz lukaszcz added this to the 0.6.6 milestone Aug 27, 2024
@lukaszcz lukaszcz self-assigned this Aug 27, 2024
Copy link
Collaborator

@janmasrovira janmasrovira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if we had a function isDebugOp : BuiltinOp -> Bool with an explicit pattern match instead of an ad hoc list

where
isDebugOp :: Node -> Bool
isDebugOp = \case
NBlt (BuiltinApp {..}) -> _builtinAppOp `elem` [OpTrace, OpFail, OpSeq]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NBlt (BuiltinApp {..}) -> _builtinAppOp `elem` [OpTrace, OpFail, OpSeq]
NBlt BuiltinApp {..} -> _builtinAppOp `elem` [OpTrace, OpFail, OpSeq]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@lukaszcz lukaszcz merged commit 7c8ac15 into main Aug 27, 2024
4 checks passed
@lukaszcz lukaszcz deleted the debug-no-let-folding branch August 27, 2024 13:52
janmasrovira pushed a commit that referenced this pull request Sep 14, 2024
After

* #2973

let-folding stopped being linear in the size of the input program. All
transformations should be linear whenever possible. This PR makes
let-folding linear again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants