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

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 22:36:16 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

<details>
<summary>Changes</summary>

As I understand ICmp ConstantExpr are planned to be removed.

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


1 Files Affected:

- (modified) llvm/lib/Analysis/InstructionSimplify.cpp (+4-4) 


``````````diff
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 40a8f6a155b23d2..5bdff48f79b4657 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -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(
+                ICmpInst::ICMP_SLT, C, Constant::getNullValue(C->getType()));
           case ICmpInst::ICMP_SLT:
           case ICmpInst::ICMP_SLE:
-            return ConstantExpr::getICmp(ICmpInst::ICMP_SGE, C,
-                                         Constant::getNullValue(C->getType()));
+            return ConstantFoldCompareInstruction(
+                ICmpInst::ICMP_SGE, C, Constant::getNullValue(C->getType()));
           }
         }
       }

``````````

</details>


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


More information about the llvm-commits mailing list