| Issue |
114736
|
| Summary |
[InstCombine] wrong folding of `lshr (mul ...)` to `(add (lshr ..)` for an undefined input
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bongjunj
|
https://github.com/llvm/llvm-project/blob/390300d9f41df6ad71f0f4196ef4885d4bd5dc48/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp#L1550-L1558
Alive2 report: https://alive2.llvm.org/ce/z/nEyusM
```llvm
----------------------------------------
define i32 @mul_splat_fold_no_nuw.2(i32 %x, ptr %#0) {
#1:
%#2 = srem i32 %x, 2
%m = mul nsw i32 %#2, 65537
%t = lshr i32 %m, 16
ret i32 %t
}
=>
define i32 @mul_splat_fold_no_nuw.2(i32 %x, ptr %#0) {
#1:
%#2 = srem i32 %x, 2
%#3 = lshr i32 %#2, 16
%t = add nsw i32 %#2, %#3
ret i32 %t
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i32 %x = undef
ptr %#0 = poison
Source:
i32 %#2 = #x00000000 (0) [based on undef value]
i32 %m = #x00000000 (0)
i32 %t = #x00000000 (0)
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: 0
Block 1 > size: 1 align: 1 alloc type: 0 alive: true address: 5
Target:
i32 %#2 = #x00000000 (0)
i32 %#3 = #x00000000 (0)
i32 %t = #xffffffff (4294967295, -1)
Source value: #x00000000 (0)
Target value: #xffffffff (4294967295, -1)
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs