[PATCH] D132798: [RISCV] Add more invertible setccs to tryDemorganOfBooleanCondition.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 11:58:07 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9210
                          Setcc.getOperand(1), CCVal);
+  } else if (CCVal == ISD::SETLT && isNullConstant(Setcc.getOperand(0))) {
+    // Invert (setlt 0, X) by converting to (setlt X, 1).
----------------
craig.topper wrote:
> reames wrote:
> > I think we can generalize this for any constant operand where adding one doesn't overflow?  If so, mind doing that in a follow up?
> Its more complicated because the constant on the LHS can't be folded into the instruction. 0 is special because it will select x0. But I'll try to see if there is anything that makes sense.
Good point on the constant LHS bit.  Hadn't considered that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132798



More information about the llvm-commits mailing list