@@ -1566,9 +1566,14 @@ static void computeKnownBitsFromOperator(const Operator *I,
15661566 // Skip direct self references.
15671567 if (IncValue == P) continue ;
15681568
1569+ // Recurse, but cap the recursion to one level, because we don't
1570+ // want to waste time spinning around in loops.
1571+ // TODO: See if we can base recursion limiter on number of incoming phi
1572+ // edges so we don't overly clamp analysis.
1573+ unsigned IncDepth = MaxAnalysisRecursionDepth - 1 ;
1574+
15691575 // If the Use is a select of this phi, use the knownbit of the other
15701576 // operand to break the recursion.
1571- unsigned IncDepth = MaxAnalysisRecursionDepth - 1 ;
15721577 Value *V;
15731578 if (match (IncValue, m_Select (m_Value (), m_Specific (P), m_Value (V))) ||
15741579 match (IncValue, m_Select (m_Value (), m_Value (V), m_Specific (P)))) {
@@ -1584,11 +1589,6 @@ static void computeKnownBitsFromOperator(const Operator *I,
15841589 RecQ.CxtI = P->getIncomingBlock (u)->getTerminator ();
15851590
15861591 Known2 = KnownBits (BitWidth);
1587-
1588- // Recurse, but cap the recursion to one level, because we don't
1589- // want to waste time spinning around in loops.
1590- // TODO: See if we can base recursion limiter on number of incoming phi
1591- // edges so we don't overly clamp analysis.
15921592 computeKnownBits (IncValue, DemandedElts, Known2, IncDepth, RecQ);
15931593
15941594 // See if we can further use a conditional branch into the phi
0 commit comments