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
[InstCombine] Failure to fold sext(trunc(ashr(x,bw-1)) -> sext(ashr(x,bw-1) #48887
Comments
assigned to @rotateright |
Same is true for lshr: |
Err, submitted too soon Same is true for lshr: I think we could use ComputeNumSignBits() here. Same for zext, but we get that already: https://c.godbolt.org/z/6GqxTM |
@lebedev.ri Are you still looking at this? |
Not really. If someone wants to pick this up, feel free to.
|
Looking at the ComputeNumSignBits pattern - tests: |
Filed the 'lshr' pattern as bug 50575. But the bug title and the example in the godbolt link in the description are different and should be fixed with: So I think it's ok to close this one, but feel free to reopen or file new bugs to track other items. |
Cheers Sanjay! |
Extended Description
Alive2: https://alive2.llvm.org/ce/z/A3FMem
define i64 @src(i32 %a0) {
%a = ashr i32 %a0, 16 ; all valid 16 -> 31
%b = trunc i32 %a to i16
%c = sext i16 %b to i64
ret i64 %c
}
define i64 @tgt(i32 %a0) {
%a = ashr i32 %a0, 16
%c = sext i32 %a to i64
ret i64 %c
}
https://c.godbolt.org/z/zh7ffM
The text was updated successfully, but these errors were encountered: