[PATCH] D132373: [RISCV] When ISD::SETUGT && Imm == -1, processed before lowering

LiqinWeng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 20:44:12 PDT 2022


Miss_Grape updated this revision to Diff 456536.

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

https://reviews.llvm.org/D132373

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -3633,10 +3633,9 @@
       if (isa<ConstantSDNode>(RHS)) {
         int64_t Imm = cast<ConstantSDNode>(RHS)->getSExtValue();
         if (Imm != 0 && isInt<12>((uint64_t)Imm + 1)) {
-          // If this is an unsigned compare and the constant is -1, incrementing
-          // the constant would change behavior. The result should be false.
-          if (CCVal == ISD::SETUGT && Imm == -1)
-            return DAG.getConstant(0, DL, VT);
+          // X > -1 should have been replaced with false.
+          assert((CCVal != ISD::SETUGT || Imm != -1) &&
+                 "Missing canonicalization");
           // Using getSetCCSwappedOperands will convert SET(U)GT->SET(U)LT.
           CCVal = ISD::getSetCCSwappedOperands(CCVal);
           SDValue SetCC = DAG.getSetCC(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132373.456536.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220830/6798e6b3/attachment.bin>


More information about the llvm-commits mailing list