| Issue |
114178
|
| Summary |
InstCombine miscompilation
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bongjunj
|
The following lines are executed:
https://github.com/llvm/llvm-project/blob/3de5dbb1110887d5127e815f3ca247a9d839ee85/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L1184-L1195
Alive2 report: https://alive2.llvm.org/ce/z/4Ht3eF
```llvm
----------------------------------------
define i8 @or_not_and_and_not_and_xor_commute2.2(i8 %a0, i8 %b, i8 %c) {
#0:
%#1 = sdiv i8 %a0, 10
%and1 = and i8 %b, %b
%not1 = xor i8 %and1, 255
%or1 = or i8 %#1, %not1
%#2 = sdiv i8 %b, %not1
%and2 = and i8 %#2, %#1
%not2 = xor i8 %and2, 255
%and3 = and i8 %or1, %not2
ret i8 %and3
}
=>
define i8 @or_not_and_and_not_and_xor_commute2.2(i8 %a0, i8 %b, i8 %c) {
#0:
%#1 = sdiv i8 %a0, 10
%not1 = xor i8 %b, 255
%or1 = or i8 %#1, %not1
%#2 = sdiv i8 %b, %not1
%and2 = and i8 %#2, %#1
%and3 = xor i8 %and2, %or1
ret i8 %and3
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i8 %a0 = undef
i8 %b = #xbb (187, -69)
i8 %c = #x00 (0) [based on undef value]
Source:
i8 %#1 = #x00 (0) [based on undef value]
i8 %and1 = #xbb (187, -69)
i8 %not1 = #x44 (68)
i8 %or1 = #x44 (68)
i8 %#2 = #xff (255, -1)
i8 %and2 = #x00 (0) [based on undef value]
i8 %not2 = #xff (255, -1)
i8 %and3 = #x44 (68)
Target:
i8 %#1 = #x00 (0)
i8 %not1 = #x44 (68)
i8 %or1 = #x44 (68)
i8 %#2 = #xff (255, -1)
i8 %and2 = #xfb (251, -5)
i8 %and3 = #xbf (191, -65)
Source value: #x44 (68)
Target value: #xbf (191, -65)
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