[llvm] [ConstraintElim] Add NUW flag to sub if x >=u y. (PR #218685)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 07:42:41 PDT 2026
================
@@ -1291,6 +1291,40 @@ static bool getConstraintFromMemoryAccess(GetElementPtrInst &GEP,
return true;
}
+/// Returns true if \p I is a candidate whose poison-generating flags may be
+/// strengthened using the constraint systems.
+static bool canStrengthenFlags(Instruction *I) {
+ switch (I->getOpcode()) {
+ case Instruction::Sub:
+ // A - B does not wrap unsigned, if A >=u B. Constant operands are handled
+ // by CorrelatedValuePropagation using ranges.
----------------
nikic wrote:
For sub specifically, a constant on the RHS will get canonicalized to add anyway.
https://github.com/llvm/llvm-project/pull/218685
More information about the llvm-commits
mailing list