[PATCH] D153502: [DAGCombiner] Change foldAndOrOfSETCC() to optimize and/or patterns

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 07:11:43 PDT 2023


foad added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/zbb-cmp-combine.ll:51-52
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    minu a1, a1, a2
-; CHECK-NEXT:    sltu a0, a1, a0
+; CHECK-NEXT:    maxu a1, a1, a2
+; CHECK-NEXT:    sltu a0, a0, a1
 ; CHECK-NEXT:    ret
----------------
- RISCV was already doing this optimization - where?
- Your result is different - it uses maxu instead of minu. One of them must be wrong.


================
Comment at: llvm/test/CodeGen/RISCV/zbb-cmp-combine.ll:308-309
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    sltu a1, a0, a1
-; CHECK-NEXT:    sltu a0, a2, a0
-; CHECK-NEXT:    or a0, a1, a0
+; CHECK-NEXT:    minu a1, a1, a2
+; CHECK-NEXT:    sltu a0, a1, a0
 ; CHECK-NEXT:    ret
----------------
The point of this test is that it should not be optimized because the comparisons are different: `c<` vs `c>`. Yet you have optimized it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153502/new/

https://reviews.llvm.org/D153502



More information about the llvm-commits mailing list