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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 30 09:29:59 PDT 2023


================
@@ -3916,12 +3916,12 @@ 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 ConstantFoldCompareInstruction(
----------------
nikic wrote:

It makes no functional difference here, but you should never use the functions declared in llvm/IR/ConstantFold.h, only those in llvm/Analysis/ConstantFolding.h, which is the public API. We should maybe move the former into the `detail` namespace to make this clearer.

https://github.com/llvm/llvm-project/pull/67873


More information about the llvm-commits mailing list