| Issue |
115456
|
| Summary |
[InstCombine] miscompilation
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bongjunj
|
https://github.com/llvm/llvm-project/blob/6de5305b3d7a4a19a29b35d481a8090e2a6d3a7e/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp#L360-L363
Alive2 report: https://alive2.llvm.org/ce/z/Rq5DNd
```llvm
----------------------------------------
define i32 @test1.2(i32 %b, i32 %z) {
#0:
%c = sub i32 0, %z
%#1 = sdiv i32 %z, %c
%d = mul nsw i32 %#1, %b
%e = mul i32 %c, %d
ret i32 %e
}
=>
define i32 @test1.2(i32 %b, i32 %z) {
#0:
%#1 = icmp eq i32 %z, 2147483648
%#2 = sub nsw i32 0, %b
%#3 = select i1 %#1, i32 %#2, i32 %b
%.neg = mul i32 %#3, %z
ret i32 %.neg
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i32 %b = #x80000000 (2147483648, -2147483648)
i32 %z = #x80000000 (2147483648, -2147483648)
Source:
i32 %c = #x80000000 (2147483648, -2147483648)
i32 %#1 = #x00000001 (1)
i32 %d = #x80000000 (2147483648, -2147483648)
i32 %e = #x00000000 (0)
Target:
i1 %#1 = #x1 (1)
i32 %#2 = poison
i32 %#3 = poison
i32 %.neg = poison
Source value: #x00000000 (0)
Target value: poison
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