[llvm] [DemandedBits] Support non-constant shift amounts (PR #148880)

Panagiotis Karouzakis via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 13:11:42 PDT 2025


karouzakisp wrote:

> Miscompilation reproducer: https://alive2.llvm.org/ce/z/bSBzWM
> 
> ```
> ; bin/opt -passes=bdce test.ll -S
> define i16 @src(i32 range(i32 0, 2) %x) {
> entry:
>   %or = or i32 0, 48
>   %shl = shl i32 %or, %x
>   %trunc = trunc i32 %shl to i16
>   ret i16 %trunc
> }
> ```
> 
> ```
> define i16 @tgt(i32 range(i32 0, 2) %x) {
> entry:
>   %shl = shl i32 0, %x
>   %trunc = trunc i32 %shl to i16
>   ret i16 %trunc
> }
> ```

Fixed, Alive verifications coming soon. Hopefully this week! 

https://github.com/llvm/llvm-project/pull/148880


More information about the llvm-commits mailing list