[PATCH] D132211: [RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 10:35:12 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:4022
     translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG);
+    // x > 1 ? x : 1 -> x > 0 ? x : 1
+    if (isOneConstant(LHS) && !isa<ConstantSDNode>(RHS) &&
----------------
craig.topper wrote:
> Update this comment to `x < 1 ? x : 1 -> 0 < x ? x : 1`
Oops. I mean `1 < x ?  x : 1 -> 0 < x ? x : 1`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132211



More information about the llvm-commits mailing list