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

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 11:02:38 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))))
----------------
goldsteinn wrote:

Its necessary now that we can use non-constants. I'll seperate that to an NFC and rebase this.

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


More information about the llvm-commits mailing list