[llvm] InstSimplify: teach simplifyICmpWithConstant about samesign (PR #125899)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 07:50:21 PST 2025


================
@@ -145,6 +145,14 @@ ConstantRange ConstantRange::makeAllowedICmpRegion(CmpInst::Predicate Pred,
   }
 }
 
+ConstantRange ConstantRange::makeAsymmetricICmpRegion(CmpPredicate Pred,
+                                                      const ConstantRange &CR) {
+  if (Pred.hasSameSign() && ICmpInst::isRelational(Pred))
+    return makeAllowedICmpRegion(Pred, CR).unionWith(makeAllowedICmpRegion(
----------------
artagnon wrote:

Scratch that. After thinking some more, I think I'm missing an inverse on the sign-flipped check.

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


More information about the llvm-commits mailing list