@@ -4882,9 +4882,19 @@ llvm::fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS,
48824882}
48834883
48844884static void computeKnownFPClassFromCond (const Value *V, Value *Cond,
4885- bool CondIsTrue,
4885+ unsigned Depth, bool CondIsTrue,
48864886 const Instruction *CxtI,
48874887 KnownFPClass &KnownFromContext) {
4888+ Value *A, *B;
4889+ if (Depth < MaxAnalysisRecursionDepth &&
4890+ (CondIsTrue ? match (Cond, m_LogicalAnd (m_Value (A), m_Value (B)))
4891+ : match (Cond, m_LogicalOr (m_Value (A), m_Value (B))))) {
4892+ computeKnownFPClassFromCond (V, A, Depth + 1 , CondIsTrue, CxtI,
4893+ KnownFromContext);
4894+ computeKnownFPClassFromCond (V, B, Depth + 1 , CondIsTrue, CxtI,
4895+ KnownFromContext);
4896+ return ;
4897+ }
48884898 CmpInst::Predicate Pred;
48894899 Value *LHS;
48904900 uint64_t ClassVal = 0 ;
@@ -4925,13 +4935,13 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
49254935
49264936 BasicBlockEdge Edge0 (BI->getParent (), BI->getSuccessor (0 ));
49274937 if (Q.DT ->dominates (Edge0, Q.CxtI ->getParent ()))
4928- computeKnownFPClassFromCond (V, Cond, /* CondIsTrue =*/ true , Q. CxtI ,
4929- KnownFromContext);
4938+ computeKnownFPClassFromCond (V, Cond, /* Depth =*/ 0 , /* CondIsTrue= */ true ,
4939+ Q. CxtI , KnownFromContext);
49304940
49314941 BasicBlockEdge Edge1 (BI->getParent (), BI->getSuccessor (1 ));
49324942 if (Q.DT ->dominates (Edge1, Q.CxtI ->getParent ()))
4933- computeKnownFPClassFromCond (V, Cond, /* CondIsTrue =*/ false , Q. CxtI ,
4934- KnownFromContext);
4943+ computeKnownFPClassFromCond (V, Cond, /* Depth =*/ 0 , /* CondIsTrue= */ false ,
4944+ Q. CxtI , KnownFromContext);
49354945 }
49364946 }
49374947
@@ -4953,8 +4963,8 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
49534963 if (!isValidAssumeForContext (I, Q.CxtI , Q.DT ))
49544964 continue ;
49554965
4956- computeKnownFPClassFromCond (V, I->getArgOperand (0 ), /* CondIsTrue =*/ true ,
4957- Q.CxtI , KnownFromContext);
4966+ computeKnownFPClassFromCond (V, I->getArgOperand (0 ), /* Depth =*/ 0 ,
4967+ /* CondIsTrue= */ true , Q.CxtI , KnownFromContext);
49584968 }
49594969
49604970 return KnownFromContext;
@@ -10117,7 +10127,7 @@ void llvm::findValuesAffectedByCondition(
1011710127
1011810128 if (HasRHSC && match (A, m_Intrinsic<Intrinsic::ctpop>(m_Value (X))))
1011910129 AddAffected (X);
10120- } else if (match (Cond , m_FCmp (Pred, m_Value (A), m_Value (B)))) {
10130+ } else if (match (V , m_FCmp (Pred, m_Value (A), m_Value (B)))) {
1012110131 AddCmpOperands (A, B);
1012210132
1012310133 // fcmp fneg(x), y
0 commit comments