[all-commits] [llvm/llvm-project] 4abab5: [InstCombine] generalize canonicalization of maske...

RotateRight via All-commits all-commits at lists.llvm.org
Sat Apr 25 08:36:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4abab5c5ca7b562b80fdb5fb6279e6d2104dae16
      https://github.com/llvm/llvm-project/commit/4abab5c5ca7b562b80fdb5fb6279e6d2104dae16
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-04-25 (Sat, 25 Apr 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/and-or-icmps.ll
    M llvm/test/Transforms/InstCombine/assume2.ll
    M llvm/test/Transforms/InstCombine/icmp-or.ll
    M llvm/test/Transforms/InstCombine/icmp.ll
    M llvm/test/Transforms/InstCombine/load-cmp.ll

  Log Message:
  -----------
  [InstCombine] generalize canonicalization of masked equality comparisons

  (X | MaskC) == C --> (X & ~MaskC) == C ^ MaskC
  (X | MaskC) != C --> (X & ~MaskC) != C ^ MaskC

We have more analyis for 'and' patterns and already lean this way
in the existing code, so this should be neutral or better in IR.

If this does not do as well in codegen, the problem already exists
and we should fix that based on target costs/heuristics.

http://volta.cs.utah.edu:8080/z/oP3ecL

define void @src(i8 %x, i8 %OrC, i8 %C, i1* %p0, i1* %p1) {
  %or = or i8 %x, %OrC
  %eq = icmp eq i8 %or, %C
  store i1 %eq, i1* %p0

  %ne = icmp ne i8 %or, %C
  store i1 %ne, i1* %p1
  ret void
}

define void @tgt(i8 %x, i8 %OrC, i8 %C, i1* %p0, i1* %p1) {
  %NotOrC = xor i8 %OrC, -1
  %a = and i8 %x, %NotOrC
  %NewC = xor i8 %C, %OrC
  %eq = icmp eq i8 %a, %NewC
  store i1 %eq, i1* %p0

  %ne = icmp ne i8 %a, %NewC
  store i1 %ne, i1* %p1
  ret void
}




More information about the All-commits mailing list