[llvm] [SCEV] Better preserve wrapping info in SimplifyICmpOperands for UGE. (PR #144404)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 13:22:39 PDT 2025


================
@@ -10901,6 +10905,10 @@ bool ScalarEvolution::SimplifyICmpOperands(CmpPredicate &Pred, const SCEV *&LHS,
                        SCEV::FlagNUW);
       Pred = ICmpInst::ICMP_UGT;
       Changed = true;
+    } else if (!getUnsignedRangeMin(RHS).isMinValue()) {
----------------
antoniofrighetto wrote:

@nikic Not sure if this could be an acceptable alternative: https://gist.github.com/antoniofrighetto/83c188d5ad0a4988eec8d4c30684dafe. It started relatively well, it didn't really end up as good as originally envisioned (NFCI, as RHS is checked first for UGE, might not want this as we should preserve the flag).

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


More information about the llvm-commits mailing list