Issue 76441
Summary Incorrect instcombine optimization
Labels new issue
Assignees
Reporter ericastor
    Demonstration in alive2: https://alive2.llvm.org/ce/z/B5daAG

The function
```
define i128 @f(i128 %x) {
entry:
  %0 = and i128 %x, 36893488147419103231
  %1 = xor i128 %0, -1
  %2 = and i128 %1, 36893488147419103231
  %3 = xor i128 %x, -1
  %4 = and i128 %3, 36893488147419103231
  %5 = add i128 %2, %4
  %6 = and i128 %5, 36893488147419103231
  ret i128 %6
}
```
incorrectly optimizes to:
```
define i128 @f(i128 %x) {
entry:
  %0 = shl i128 %x, 1
  %1 = sub i128 18446744073709551614, %0
  %2 = and i128 %1, 36893488147419103230
  ret i128 %2
}
```
which disagrees on input 0.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to