[PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 01:31:39 PDT 2022


liaolucy added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:8275
+  // (add constant - 1, (setcc x, y, neq/eq))
+  if (isa<ConstantSDNode>(N0) && N1.getOpcode() == ISD::SETCC) {
+    auto *Nnz0 = cast<ConstantSDNode>(N0);
----------------
craig.topper wrote:
> Do we need to check that this is the only user of the setcc?
At present, I think only setcc, ensure that rd is only 0/1, I have not found other SDNode have this function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131471



More information about the llvm-commits mailing list