[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:21 PDT 2023


================
@@ -2696,18 +2716,25 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
       RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
       // Check if the branch on the phi excludes zero.
       ICmpInst::Predicate Pred;
-      Value *X;
+      Value *X, *Y;
       BasicBlock *TrueSucc, *FalseSucc;
       if (match(RecQ.CxtI,
-                m_Br(m_c_ICmp(Pred, m_Specific(U.get()), m_Value(X)),
+                m_Br(m_ICmp(Pred, m_Value(X), m_Value(Y)),
----------------
dtcxzyw wrote:

So is this one.

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


More information about the llvm-commits mailing list