@@ -1568,10 +1568,13 @@ static void computeKnownBitsFromOperator(const Operator *I,
15681568
15691569 // If the Use is a select of this phi, use the knownbit of the other
15701570 // operand to break the recursion.
1571+ unsigned IncDepth = MaxAnalysisRecursionDepth - 1 ;
15711572 Value *V;
15721573 if (match (IncValue, m_Select (m_Value (), m_Specific (P), m_Value (V))) ||
1573- match (IncValue, m_Select (m_Value (), m_Value (V), m_Specific (P))))
1574+ match (IncValue, m_Select (m_Value (), m_Value (V), m_Specific (P)))) {
15741575 IncValue = V;
1576+ IncDepth = Depth + 1 ;
1577+ }
15751578
15761579 // Change the context instruction to the "edge" that flows into the
15771580 // phi. This is important because that is where the value is actually
@@ -1586,8 +1589,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
15861589 // want to waste time spinning around in loops.
15871590 // TODO: See if we can base recursion limiter on number of incoming phi
15881591 // edges so we don't overly clamp analysis.
1589- computeKnownBits (IncValue, DemandedElts, Known2,
1590- MaxAnalysisRecursionDepth - 1 , RecQ);
1592+ computeKnownBits (IncValue, DemandedElts, Known2, IncDepth, RecQ);
15911593
15921594 // See if we can further use a conditional branch into the phi
15931595 // to help us determine the range of the value.
0 commit comments