-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
JumpThreading error removes call void @bar()
instruction.
#65195
JumpThreading error removes call void @bar()
instruction.
#65195
Comments
We changed the meaning of those metadata nodes precisely to make this transform legal... the current text in LangRef reflects this. The hoisted load returns poison, and its value is never used if it would be poison. It's possible we missed something when we made that change, but I suspect the issue you're seeing is unrelated. |
I think the reproducer simply got lost. The godbold link seems to show a valid transformation. The range metadata is fine, as it can be violated w/o causing an issue. In the original reproducer, the load with the range feeds into a branch (which is UB on poison), causing the issue, I suppose: Maybe we need to reduce again to find the location that miscompiles this. |
Yes, I have read this before this issue. Hoisting a poison is safe only when it doesn't introduce more UB.
I got the reduced IR, the branch on poison is not this end-to-end reason. I put this on the top description. |
As far as I can tell, JumpThreading is the faulty transform here. My guess to what happens is this: JumpThreading performs load CSE under some circumstances. It correctly calls combineMetadataForCSE in that case -- as you can see, the !range metadata gets correctly dropped from the transformation result. However, the load will still be cached in LVI, even though the cached value is no longer valid for the new use. Possibly all that is missing here is an LVI invalidation when adjusting the metadata on the load? |
I seem to get it. I can't infer the range of the next load from the range of the previous load, even if there is no store instruction in between. |
call void @bar()
instruction.
Reopen it for the backport. |
/branch llvm/llvm-project-release-prs/issue65195 |
/pull-request llvm/llvm-project-release-prs#685 |
I tried the reduced IR that from rust-lang/rust#115385:
JumpThreading error removes call void @bar() instruction.
https://llvm.godbolt.org/z/ncv4rErdx
LLVM version is 17.0.0-rc3.
The text was updated successfully, but these errors were encountered: