[llvm] a5686c2 - [InstSimplify] Avoid use of ConstantExpr::getICmp. NFC (#67873)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 30 13:01:34 PDT 2023


Author: Craig Topper
Date: 2023-09-30T13:01:29-07:00
New Revision: a5686c2b5541c58c9a1dd760761c369124546f78

URL: https://github.com/llvm/llvm-project/commit/a5686c2b5541c58c9a1dd760761c369124546f78
DIFF: https://github.com/llvm/llvm-project/commit/a5686c2b5541c58c9a1dd760761c369124546f78.diff

LOG: [InstSimplify] Avoid use of ConstantExpr::getICmp. NFC (#67873)

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 40a8f6a155b23d2..b3feb2470e58efd 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3916,12 +3916,14 @@ static Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
           // is non-negative then LHS <s RHS.
           case ICmpInst::ICMP_SGT:
           case ICmpInst::ICMP_SGE:
-            return ConstantExpr::getICmp(ICmpInst::ICMP_SLT, C,
-                                         Constant::getNullValue(C->getType()));
+            return ConstantFoldCompareInstOperands(
+                ICmpInst::ICMP_SLT, C, Constant::getNullValue(C->getType()),
+                Q.DL);
           case ICmpInst::ICMP_SLT:
           case ICmpInst::ICMP_SLE:
-            return ConstantExpr::getICmp(ICmpInst::ICMP_SGE, C,
-                                         Constant::getNullValue(C->getType()));
+            return ConstantFoldCompareInstOperands(
+                ICmpInst::ICMP_SGE, C, Constant::getNullValue(C->getType()),
+                Q.DL);
           }
         }
       }


        


More information about the llvm-commits mailing list