[all-commits] [llvm/llvm-project] eb1e2b: [InstCombine] Canonicalize "and, add", "or, add", ...

Eric Gullufsen via All-commits all-commits at lists.llvm.org
Fri Aug 26 14:23:45 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb1e2b39978c4ea901198d78d57ff70bf9a85b60
      https://github.com/llvm/llvm-project/commit/eb1e2b39978c4ea901198d78d57ff70bf9a85b60
  Author: Eric Gullufsen <ericgullufsen at gmail.com>
  Date:   2022-08-26 (Fri, 26 Aug 2022)

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

  Log Message:
  -----------
  [InstCombine] Canonicalize "and, add", "or, add", "xor, add"

Canonicalize
```
((x + C1) & C2) --> ((x & C2) + C1)
((x + C1) ^ C2) --> ((x ^ C2) + C1)
((x + C1) | C2) --> ((x | C2) + C1)
```
for suitable constants `C1` and `C2`.

Alive2 proofs: [[ https://alive2.llvm.org/ce/z/BqMDVZ | add, or --> or, add ]]
[[ https://alive2.llvm.org/ce/z/BhAeCl | add, xor --> xor, add ]]
[[ https://alive2.llvm.org/ce/z/jYRHEt | add, and --> and, add ]]

Reviewed By: spatel

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




More information about the All-commits mailing list