@@ -811,7 +811,7 @@ static Value *simplifySubInst(Value *Op0, Value *Op1, bool IsNSW, bool IsNUW,
811811 if (IsNUW)
812812 return Constant::getNullValue (Op0->getType ());
813813
814- KnownBits Known = computeKnownBits (Op1, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
814+ KnownBits Known = computeKnownBits (Op1, /* Depth */ 0 , Q);
815815 if (Known.Zero .isMaxSignedValue ()) {
816816 // Op1 is either 0 or the minimum signed value. If the sub is NSW, then
817817 // Op1 must be 0 because negating the minimum signed value is undefined.
@@ -1063,7 +1063,7 @@ static bool isDivZero(Value *X, Value *Y, const SimplifyQuery &Q,
10631063 // ("computeConstantRangeIncludingKnownBits")?
10641064 const APInt *C;
10651065 if (match (Y, m_APInt (C)) &&
1066- computeKnownBits (X, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT ).getMaxValue ().ult (*C))
1066+ computeKnownBits (X, /* Depth */ 0 , Q).getMaxValue ().ult (*C))
10671067 return true ;
10681068
10691069 // Try again for any divisor:
@@ -1125,8 +1125,7 @@ static Value *simplifyDivRem(Instruction::BinaryOps Opcode, Value *Op0,
11251125 if (Op0 == Op1)
11261126 return IsDiv ? ConstantInt::get (Ty, 1 ) : Constant::getNullValue (Ty);
11271127
1128-
1129- KnownBits Known = computeKnownBits (Op1, Q.DL , 0 , Q.AC , Q.CxtI , Q.DT );
1128+ KnownBits Known = computeKnownBits (Op1, /* Depth */ 0 , Q);
11301129 // X / 0 -> poison
11311130 // X % 0 -> poison
11321131 // If the divisor is known to be zero, just return poison. This can happen in
@@ -1195,7 +1194,7 @@ static Value *simplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
11951194 // less trailing zeros, then the result must be poison.
11961195 const APInt *DivC;
11971196 if (IsExact && match (Op1, m_APInt (DivC)) && DivC->countr_zero ()) {
1198- KnownBits KnownOp0 = computeKnownBits (Op0, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
1197+ KnownBits KnownOp0 = computeKnownBits (Op0, /* Depth */ 0 , Q);
11991198 if (KnownOp0.countMaxTrailingZeros () < DivC->countr_zero ())
12001199 return PoisonValue::get (Op0->getType ());
12011200 }
@@ -1355,7 +1354,7 @@ static Value *simplifyShift(Instruction::BinaryOps Opcode, Value *Op0,
13551354
13561355 // If any bits in the shift amount make that value greater than or equal to
13571356 // the number of bits in the type, the shift is undefined.
1358- KnownBits KnownAmt = computeKnownBits (Op1, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
1357+ KnownBits KnownAmt = computeKnownBits (Op1, /* Depth */ 0 , Q);
13591358 if (KnownAmt.getMinValue ().uge (KnownAmt.getBitWidth ()))
13601359 return PoisonValue::get (Op0->getType ());
13611360
@@ -1368,7 +1367,7 @@ static Value *simplifyShift(Instruction::BinaryOps Opcode, Value *Op0,
13681367 // Check for nsw shl leading to a poison value.
13691368 if (IsNSW) {
13701369 assert (Opcode == Instruction::Shl && " Expected shl for nsw instruction" );
1371- KnownBits KnownVal = computeKnownBits (Op0, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
1370+ KnownBits KnownVal = computeKnownBits (Op0, /* Depth */ 0 , Q);
13721371 KnownBits KnownShl = KnownBits::shl (KnownVal, KnownAmt);
13731372
13741373 if (KnownVal.Zero .isSignBitSet ())
@@ -1404,8 +1403,7 @@ static Value *simplifyRightShift(Instruction::BinaryOps Opcode, Value *Op0,
14041403 // The low bit cannot be shifted out of an exact shift if it is set.
14051404 // TODO: Generalize by counting trailing zeros (see fold for exact division).
14061405 if (IsExact) {
1407- KnownBits Op0Known =
1408- computeKnownBits (Op0, Q.DL , /* Depth=*/ 0 , Q.AC , Q.CxtI , Q.DT );
1406+ KnownBits Op0Known = computeKnownBits (Op0, /* Depth */ 0 , Q);
14091407 if (Op0Known.One [0 ])
14101408 return Op0;
14111409 }
@@ -1477,7 +1475,7 @@ static Value *simplifyLShrInst(Value *Op0, Value *Op1, bool IsExact,
14771475 if (Q.IIQ .UseInstrInfo && match (Op1, m_APInt (ShRAmt)) &&
14781476 match (Op0, m_c_Or (m_NUWShl (m_Value (X), m_APInt (ShLAmt)), m_Value (Y))) &&
14791477 *ShRAmt == *ShLAmt) {
1480- const KnownBits YKnown = computeKnownBits (Y, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
1478+ const KnownBits YKnown = computeKnownBits (Y, /* Depth */ 0 , Q);
14811479 const unsigned EffWidthY = YKnown.countMaxActiveBits ();
14821480 if (ShRAmt->uge (EffWidthY))
14831481 return X;
@@ -2105,7 +2103,7 @@ static Value *simplifyAndInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
21052103 match (Op0, m_Add (m_Value (Shift), m_AllOnes ())) &&
21062104 isKnownToBeAPowerOfTwo (Shift, Q.DL , /* OrZero*/ false , 0 , Q.AC , Q.CxtI ,
21072105 Q.DT )) {
2108- KnownBits Known = computeKnownBits (Shift, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2106+ KnownBits Known = computeKnownBits (Shift, /* Depth */ 0 , Q);
21092107 // Use getActiveBits() to make use of the additional power of two knowledge
21102108 if (PowerC->getActiveBits () >= Known.getMaxValue ().getActiveBits ())
21112109 return ConstantInt::getNullValue (Op1->getType ());
@@ -2169,10 +2167,10 @@ static Value *simplifyAndInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
21692167 m_Value (Y)))) {
21702168 const unsigned Width = Op0->getType ()->getScalarSizeInBits ();
21712169 const unsigned ShftCnt = ShAmt->getLimitedValue (Width);
2172- const KnownBits YKnown = computeKnownBits (Y, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2170+ const KnownBits YKnown = computeKnownBits (Y, /* Depth */ 0 , Q);
21732171 const unsigned EffWidthY = YKnown.countMaxActiveBits ();
21742172 if (EffWidthY <= ShftCnt) {
2175- const KnownBits XKnown = computeKnownBits (X, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2173+ const KnownBits XKnown = computeKnownBits (X, /* Depth */ 0 , Q);
21762174 const unsigned EffWidthX = XKnown.countMaxActiveBits ();
21772175 const APInt EffBitsY = APInt::getLowBitsSet (Width, EffWidthY);
21782176 const APInt EffBitsX = APInt::getLowBitsSet (Width, EffWidthX) << ShftCnt;
@@ -2968,15 +2966,15 @@ static Value *simplifyICmpWithZero(CmpInst::Predicate Pred, Value *LHS,
29682966 return getTrue (ITy);
29692967 break ;
29702968 case ICmpInst::ICMP_SLT: {
2971- KnownBits LHSKnown = computeKnownBits (LHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2969+ KnownBits LHSKnown = computeKnownBits (LHS, /* Depth */ 0 , Q);
29722970 if (LHSKnown.isNegative ())
29732971 return getTrue (ITy);
29742972 if (LHSKnown.isNonNegative ())
29752973 return getFalse (ITy);
29762974 break ;
29772975 }
29782976 case ICmpInst::ICMP_SLE: {
2979- KnownBits LHSKnown = computeKnownBits (LHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2977+ KnownBits LHSKnown = computeKnownBits (LHS, /* Depth */ 0 , Q);
29802978 if (LHSKnown.isNegative ())
29812979 return getTrue (ITy);
29822980 if (LHSKnown.isNonNegative () &&
@@ -2985,15 +2983,15 @@ static Value *simplifyICmpWithZero(CmpInst::Predicate Pred, Value *LHS,
29852983 break ;
29862984 }
29872985 case ICmpInst::ICMP_SGE: {
2988- KnownBits LHSKnown = computeKnownBits (LHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2986+ KnownBits LHSKnown = computeKnownBits (LHS, /* Depth */ 0 , Q);
29892987 if (LHSKnown.isNegative ())
29902988 return getFalse (ITy);
29912989 if (LHSKnown.isNonNegative ())
29922990 return getTrue (ITy);
29932991 break ;
29942992 }
29952993 case ICmpInst::ICMP_SGT: {
2996- KnownBits LHSKnown = computeKnownBits (LHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
2994+ KnownBits LHSKnown = computeKnownBits (LHS, /* Depth */ 0 , Q);
29972995 if (LHSKnown.isNegative ())
29982996 return getFalse (ITy);
29992997 if (LHSKnown.isNonNegative () &&
@@ -3070,8 +3068,8 @@ static Value *simplifyICmpWithBinOpOnLHS(CmpInst::Predicate Pred,
30703068 return getTrue (ITy);
30713069
30723070 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) {
3073- KnownBits RHSKnown = computeKnownBits (RHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
3074- KnownBits YKnown = computeKnownBits (Y, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
3071+ KnownBits RHSKnown = computeKnownBits (RHS, /* Depth */ 0 , Q);
3072+ KnownBits YKnown = computeKnownBits (Y, /* Depth */ 0 , Q);
30753073 if (RHSKnown.isNonNegative () && YKnown.isNegative ())
30763074 return Pred == ICmpInst::ICMP_SLT ? getTrue (ITy) : getFalse (ITy);
30773075 if (RHSKnown.isNegative () || YKnown.isNonNegative ())
@@ -3094,7 +3092,7 @@ static Value *simplifyICmpWithBinOpOnLHS(CmpInst::Predicate Pred,
30943092 break ;
30953093 case ICmpInst::ICMP_SGT:
30963094 case ICmpInst::ICMP_SGE: {
3097- KnownBits Known = computeKnownBits (RHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
3095+ KnownBits Known = computeKnownBits (RHS, /* Depth */ 0 , Q);
30983096 if (!Known.isNonNegative ())
30993097 break ;
31003098 [[fallthrough]];
@@ -3105,7 +3103,7 @@ static Value *simplifyICmpWithBinOpOnLHS(CmpInst::Predicate Pred,
31053103 return getFalse (ITy);
31063104 case ICmpInst::ICMP_SLT:
31073105 case ICmpInst::ICMP_SLE: {
3108- KnownBits Known = computeKnownBits (RHS, Q. DL , 0 , Q. AC , Q. CxtI , Q. DT );
3106+ KnownBits Known = computeKnownBits (RHS, /* Depth */ 0 , Q);
31093107 if (!Known.isNonNegative ())
31103108 break ;
31113109 [[fallthrough]];
0 commit comments