[llvm] d094bb6 - [InstSimplify] Avoid use of ConstantExpr::getICmp() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 00:27:00 PDT 2024


Author: Nikita Popov
Date: 2024-05-21T09:26:51+02:00
New Revision: d094bb660d48fd1beadc0e2456f104ab2cc7f52c

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

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

Use ConstantFoldCompareInstOperands() instead.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index e88736b5fab8d..53a974c5294c6 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3954,12 +3954,14 @@ static Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
           // 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);
 
           // If LHS is non-negative then LHS <u RHS.  If LHS is negative then
           // LHS >u RHS.


        


More information about the llvm-commits mailing list