[all-commits] [llvm/llvm-project] 38e3b3: [InstCombine] add tests for (iN X s>> N-1) | Y; NFC

RotateRight via All-commits all-commits at lists.llvm.org
Sat Oct 9 09:20:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38e3b30bd62c8c6007a6b1f9c9ee90168434b3b3
      https://github.com/llvm/llvm-project/commit/38e3b30bd62c8c6007a6b1f9c9ee90168434b3b3
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-10-09 (Sat, 09 Oct 2021)

  Changed paths:
    M llvm/test/Transforms/InstCombine/or.ll

  Log Message:
  -----------
  [InstCombine] add tests for (iN X s>> N-1) | Y; NFC

These are for a sibling fold suggested in D111410.
The tests correspond to the 'and' tests added with:
a35673f4cfc4


  Commit: cd76fa79b01aef8afe219323f713ca1607d7a98f
      https://github.com/llvm/llvm-project/commit/cd76fa79b01aef8afe219323f713ca1607d7a98f
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-10-09 (Sat, 09 Oct 2021)

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

  Log Message:
  -----------
  [InstCombine] add tests for icmp of negated op; NFC


  Commit: acafde09a3fa9560148605f35f9c3d3f1444bc15
      https://github.com/llvm/llvm-project/commit/acafde09a3fa9560148605f35f9c3d3f1444bc15
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-10-09 (Sat, 09 Oct 2021)

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

  Log Message:
  -----------
  [InstCombine] enhance icmp with sub folds

There were 2 related but over-specified folds for:
C1 - X == C

One allowed multi-use but was limited to equal constants.
The other allowed different constants but disallowed multi-use.

This combines the 2 folds into a more general match.
The test diffs show the multi-use cases that were falling
through the cracks.

https://alive2.llvm.org/ce/z/4_hEt2

  define i1 @src(i8 %x, i8 %subC, i8 %C) {
    %s = sub i8 %subC, %x
    %r = icmp eq i8 %s, %C
    ret i1 %r
  }

  define i1 @tgt(i8 %x, i8 %subC, i8 %C) {
    %newC = sub i8 %subC, %C
    %isneg = icmp eq i8 %x, %newC
    ret i1 %isneg
  }


Compare: https://github.com/llvm/llvm-project/compare/943b3048484b...acafde09a3fa


More information about the All-commits mailing list