[all-commits] [llvm/llvm-project] 83ad4c: [InstCombine] Add tests for folding `(icmp eq/ne (...

goldsteinn via All-commits all-commits at lists.llvm.org
Wed Jul 12 15:18:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83ad4cb61f4d8f36be07e7d9d89529921f0c1d2f
      https://github.com/llvm/llvm-project/commit/83ad4cb61f4d8f36be07e7d9d89529921f0c1d2f
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M llvm/test/Transforms/InstCombine/icmp-ext-ext.ll

  Log Message:
  -----------
  [InstCombine] Add tests for folding `(icmp eq/ne (zext i1) (sext i1))`; NFC

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


  Commit: d50c1fcb5d3ce0a5f2da5ef8f61ac730a213509b
      https://github.com/llvm/llvm-project/commit/d50c1fcb5d3ce0a5f2da5ef8f61ac730a213509b
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-ext-ext.ll

  Log Message:
  -----------
  [InstCombine] Fold `(icmp eq/ne (zext i1 X) (sext i1 Y))`-> `(icmp eq/ne (or X, Y), 0)`

This comes up when adding two `bool` types in C/C++
```
    bool foo(bool a, bool b) {
        return a + b;
    }
    ...
    ->
    define i1 @foo(i1 %a, i1 %b) {
        %conv = zext i1 %a to i32
        %conv3.neg = sext i1 %b to i32
        %tobool4 = icmp ne i32 %conv, %conv3.neg
        ret i1 %tobool4
}
```

Proof: https://alive2.llvm.org/ce/z/HffWAN

Reviewed By: nikic

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


  Commit: eccb454177765eb66549fcbaa9b919566e53a2a7
      https://github.com/llvm/llvm-project/commit/eccb454177765eb66549fcbaa9b919566e53a2a7
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/divrem-by-select.ll

  Log Message:
  -----------
  [X86] Add tests for `div/rem %x, (select c, <const>, 1)`; NFC

Reviewed By: pengfei

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


  Commit: 74f0ec5e2435fba1a6ad35f78548cb0d706a1bca
      https://github.com/llvm/llvm-project/commit/74f0ec5e2435fba1a6ad35f78548cb0d706a1bca
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAG.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll
    M llvm/test/CodeGen/X86/divrem-by-select.ll

  Log Message:
  -----------
  [DAGCombiner] Make it so that `udiv` can be folded with `(select c, NonZero, 1)`

This is done by allowing speculation of `udiv` if we can prove the
denominator is non-zero.

https://alive2.llvm.org/ce/z/VNCt_q

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


  Commit: 24f752ed2e272f85aba8f2176d21656bbe5f373e
      https://github.com/llvm/llvm-project/commit/24f752ed2e272f85aba8f2176d21656bbe5f373e
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/known-never-zero.ll

  Log Message:
  -----------
  [X86] Add tests for checking `isKnownNeverZero`; NFC

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


  Commit: a4c461c063a2ef229d577d050fef3cff7284fc4b
      https://github.com/llvm/llvm-project/commit/a4c461c063a2ef229d577d050fef3cff7284fc4b
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/X86/divrem-by-select.ll
    M llvm/test/CodeGen/X86/known-never-zero.ll

  Log Message:
  -----------
  [SelectionDAG] Fill in some more cases in `isKnownNeverZero`

This mostly copies cases that already exist in ValueTracking, although
it skips the more complex ones. Those can be filled in as needed.

Reviewed By: RKSimon

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


Compare: https://github.com/llvm/llvm-project/compare/7e6f2b749bf7...a4c461c063a2


More information about the All-commits mailing list