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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 11:47:23 PDT 2022


craig.topper 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).
----------------
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.


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