-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
[CVP] Failure to recognise trunc nsw from assumptions #130100
Comments
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Simon Pilgrim (RKSimon)
Pulled out of #130088
```ll
----------------------------------------
define i8 @src(i16 noundef %x) {
#0:
%add = add i16 noundef %x, 128
%or.cond.i = icmp ult i16 %add, 256
assume i1 %or.cond.i
%conv1 = trunc i16 noundef %x to i8
ret i8 %conv1
}
=>
define i8 @tgt(i16 noundef %x) {
#0:
%conv1 = trunc nsw i16 noundef %x to i8
ret i8 %conv1
}
Transformation seems to be correct!
```
https://alive2.llvm.org/ce/z/2qhZy4
|
@dtcxzyw Can iI give this a go if no one else is already working on it? |
@llvmbot Could you please provide more details on the expected behavior? |
@bababuck sorry, I didn't know you were assigned to this. |
Proof: https://alive2.llvm.org/ce/z/U-G7yV Helps: rust-lang/rust#72646 and rust-lang/rust#122734 Rust compiler's current output: https://godbolt.org/z/7E3fET6Md IPSCCP can do this transform but it does not help the motivating issue since it runs only once early in the optimization pipeline. Reimplementing this in CVP folds the motivating issue into a simple `icmp eq` instruction. Fixes llvm#130100
Pulled out of #130088
https://alive2.llvm.org/ce/z/2qhZy4
The text was updated successfully, but these errors were encountered: