[llvm] [InstCombine] Recognize non-negative subtraction patterns (PR #182597)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 21:09:30 PST 2026


================
@@ -647,6 +647,21 @@ static Value *foldSelectICmpMinMax(const ICmpInst *Cmp, Value *TVal,
   const Value *CmpRHS = Cmp->getOperand(1);
   ICmpInst::Predicate Pred = Cmp->getPredicate();
 
+  if (Pred == CmpInst::ICMP_SLT && match(TVal, m_Zero()) &&
----------------
user1342234 wrote:

Since this canonicalization is for `select` non-negative case, I will move it to the second PR with this as well. 

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


More information about the llvm-commits mailing list