-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SimplifyCFG: General jump threading needs to update all available values when updating SSA #31182
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
SimplifyCFG: General jump threading needs to update all available values when updating SSA #31182
Conversation
@swift-ci Please test |
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, this should work but... somehow we need to make sure canCloneInstruction
is called for every instruction in the block, otherwise we have a different correctness problem. Checking for 'needsSSAUpdate' currently ensures that it will be called.
I'm guessing the problem is that SimplifyCFG materializes an enum after calling canCloneBlock
. The better fix would be to have SimplifyCFG call canCloneInstruction on the new instruction, rather than add a flag to the Cloner interface.
We could rename canCloneInstruction
to checkCloneInstruction
to indicate that it has side effects.
The code you added to updateSSAAfterCloning
could remain under an assert
if (!needsUpdate) {
for (auto &inst : *origBB) {
for (auto res : inst.getResults()) {
assert(!isUsedOutsideOfBlock(res))
}
}
}
}
But would that be any better than the assert that you currently hit with this bug?
Hmm, the problem was the existing:
It would seem then the SinkAddressProjections stuff does not work then. |
I'll take another look at what is going on there. |
I'm happy to debug this immediately after my current debugging session. |
Build failed |
Got it. When we walk back an address projection and we meet an instruction that produces an address but is not pure we need to set needsSSAUpdate instead of doing nothing.
|
e1c0133
to
7549bfe
Compare
@swift-ci Please test |
Build failed |
Build failed |
This is supposed to maintain an invariant that
Instead of just checking one operand, is to make sure all of the operands are added to
It looks like I intended to write that but somehow it got lost. Unfortunately that means this example will not get jump-threaded. If that's a problem, it's probably a separate bug to deal with! |
… instruction live-out of a block. rdar://61232730
7549bfe
to
3f22bfd
Compare
@swift-ci Please test |
Build failed |
Build failed |
This was introduced by refactors in this area.
rdar://61232730