[llvm] [ValueTracking] Compute knownbits from `(icmp ult/ule (add nuw X, Y), C)` (PR #87180)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 31 00:04:12 PDT 2024
================
@@ -9283,11 +9289,21 @@ void llvm::findValuesAffectedByCondition(
AddAffected(X);
}
} else {
- // Handle (A + C1) u< C2, which is the canonical form of
- // A > C3 && A < C4.
- if (match(A, m_AddLike(m_Value(X), m_ConstantInt())) &&
- match(B, m_ConstantInt()))
- AddAffected(X);
+ if (match(B, m_ConstantInt())) {
+ // Handle (A + C1) u< C2, which is the canonical form of
+ // A > C3 && A < C4.
+ if (match(A, m_AddLike(m_Value(X), m_ConstantInt())))
+ AddAffected(X);
+
+ Value *Y;
+ // X & Y u> C -> X >u C && Y >u C
+ // X | Y u< C -> X u< C && Y u< C
----------------
dtcxzyw wrote:
Please update the comments.
https://github.com/llvm/llvm-project/pull/87180
More information about the llvm-commits
mailing list