-
Notifications
You must be signed in to change notification settings - Fork 14
fix: DeadCodeElim keeps consumers of linear outputs #2560
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9970f0f
DeadCodeElim requires consumers of linear outputs of required nodes
acl-cqc f17942c
add PR link...is that good?
acl-cqc e7f6a3e
Extend test to demonstrate we do not preserve consumers of copyable v…
acl-cqc 625fb59
Rewrite using signature of node n
acl-cqc e5e8f4c
Assert entrypoints are present, fix composable::test_then
acl-cqc a30f022
Skip missing entrypoints (Revert "Assert entrypoints are present, fix…
acl-cqc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Query the signature once outside the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature of target of edge leaving n, may be different for each edge
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done the other way. This revealed that DCE had been silently skipping any
with_entrypointsnot in the Hugr (!). I turned that into an assert in e5e8f4c, which required fixing a test, but (a) that's a behaviour change, so should probably be considered breaking; (b) if we do want to do that, should be an actual error, and DeadCodeElimPass hastype Error = Infallible, so definitely breaking.Hence, I've added an explicit check to skip such nodes. If you're ok with that, I'm happy to make an issue/wait-to-merge-PR to turn this into an error for the next breaking release??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring invalid nodes seems like a safe solution here.
Agreed that this should be turned into an error in a breaking release.
(Make an issue and put it on the next release milestone)