[all-commits] [llvm/llvm-project] a905c5: [InstCombine] Fold `(~(a | b) & c) | ~(a | c)` int...

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Fri Oct 29 10:58:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a905c54b766ed44f498594b53354d40bae38c07a
      https://github.com/llvm/llvm-project/commit/a905c54b766ed44f498594b53354d40bae38c07a
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/and-xor-or.ll

  Log Message:
  -----------
  [InstCombine] Fold `(~(a | b) & c) | ~(a | c)` into `~((b & c) | a)`

```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
  %or1 = or i4 %b, %a
  %not1 = xor i4 %or1, -1
  %or2 = or i4 %a, %c
  %not2 = xor i4 %or2, -1
  %and = and i4 %not2, %b
  %or3 = or i4 %and, %not1
  ret i4 %or3
}

define i4 @tgt(i4 %a, i4 %b, i4 %c) {
  %and = and i4 %c, %b
  %or = or i4 %and, %a
  %or3 = xor i4 %or, -1
  ret i4 %or3
}
Transformation seems to be correct!
```

Differential Revision: https://reviews.llvm.org/D112338




More information about the All-commits mailing list