[llvm] [ValueTracking] Expand cmpExcludesZero to optionally work with non-constant RHS (PR #69364)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 05:33:22 PDT 2023


================
@@ -2666,15 +2680,21 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
 
       // The condition of the select dominates the true/false arm. Check if the
       // condition implies that a given arm is non-zero.
-      Value *X;
+      Value *X, *Y;
       CmpInst::Predicate Pred;
-      if (!match(I->getOperand(0), m_c_ICmp(Pred, m_Specific(Op), m_Value(X))))
+      if (!match(I->getOperand(0), m_ICmp(Pred, m_Value(X), m_Value(Y))))
----------------
dtcxzyw wrote:

It seems like a NFC change. Does this change improve matching performance?

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


More information about the llvm-commits mailing list