[PATCH] D129757: [RISCV] Optimize SELECT_CC when the true value of select is Constant

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 19:10:42 PDT 2022


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3900
+          DAG.getCondCode(ISD::getSetCCInverse(CCVal, LHS.getValueType()));
+      SDValue Ops[] = {LHS, RHS, TargetCC, FalseV, TrueV};
+      return DAG.getNode(RISCVISD::SELECT_CC, DL, Op.getValueType(), Ops);
----------------
frasercrmck wrote:
> Could we instead just `std::swap(TrueV, FalseV)` and let it fall through? I think that's clearer to read.
This still isn't falling through. Ops and the return are identical to outside the if, you can just reuse them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129757



More information about the llvm-commits mailing list