SuccessChanges

Summary

  1. [NFC] Added/adjusted tests for PR48604; second pattern (details)
  2. [InstCombine] Transform (A + B) - (A & B) to A | B (PR48604) (details)
Commit c1937c2af2a03f0b5fda3bbf99e2971ffa04ff0c by Dávid Bolvanský
[NFC] Added/adjusted tests for PR48604; second pattern
The file was modifiedllvm/test/Transforms/InstCombine/and.ll
The file was modifiedllvm/test/Transforms/InstCombine/sub.ll
Commit ae69fa9b9f65f59cc0ca8c47f23748a53c8dbdc5 by Dávid Bolvanský
[InstCombine] Transform (A + B) - (A & B) to A | B (PR48604)

define i32 @src(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, %y
  %o = and i32 %x, %y
  %r = sub i32 %a, %o
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %b = or i32 %x, %y
  ret i32 %b
}
Transformation seems to be correct!

https://alive2.llvm.org/ce/z/2fhW6r
The file was modifiedllvm/test/Transforms/InstCombine/sub.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp