[all-commits] [llvm/llvm-project] b3fca0: [NFC][InstCombine] Add some tests for `(X | C2) ^ ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Sat Apr 2 14:13:58 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3fca02a6de1d1b1d2f41bf70dd3a78187577ec4
      https://github.com/llvm/llvm-project/commit/b3fca02a6de1d1b1d2f41bf70dd3a78187577ec4
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-04-03 (Sun, 03 Apr 2022)

  Changed paths:
    A llvm/test/Transforms/InstCombine/xor-of-or.ll

  Log Message:
  -----------
  [NFC][InstCombine] Add some tests for `(X | C2) ^ C1` pattern


  Commit: 3ae08dac8f1031a5874572bf6f0a50097e1fbd25
      https://github.com/llvm/llvm-project/commit/3ae08dac8f1031a5874572bf6f0a50097e1fbd25
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-04-03 (Sun, 03 Apr 2022)

  Changed paths:
    M llvm/test/Transforms/InstCombine/apint-and.ll

  Log Message:
  -----------
  [NFC][InstCombine] Autogenerate check lines in a test affected by the future change


  Commit: 308ca349cbc5fa891b08c525084fc86017bdc498
      https://github.com/llvm/llvm-project/commit/308ca349cbc5fa891b08c525084fc86017bdc498
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-04-03 (Sun, 03 Apr 2022)

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

  Log Message:
  -----------
  [InstCombine] Fold `(X | C2) ^ C1 --> (X & ~C2) ^ (C1^C2)`

These two are equivalent,
and i *think* the `and` form is more-ish canonical.

General proof: https://alive2.llvm.org/ce/z/RrF5s6

If constant on the (outer) `xor` is an `undef`,
the whole lane is dead: https://alive2.llvm.org/ce/z/mu4Sh2

However, if the constant on the (inner) `or` is an `undef`,
we must sanitize it first: https://alive2.llvm.org/ce/z/MHYJL7
I guess, producing a zero `and`-mask is optimal in that case.

alive-tv is happy about the entirety of `xor-of-or.ll`.


Compare: https://github.com/llvm/llvm-project/compare/578d85e924fc...308ca349cbc5


More information about the All-commits mailing list