[ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298683 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2017-03-24 03:57:24 +00:00
parent 5382346d94
commit d738e6a7b3

View File

@ -971,7 +971,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
LeadZ = std::min(BitWidth,
LeadZ + BitWidth - RHSUnknownLeadingOnes - 1);
KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ);
KnownZero.setHighBits(LeadZ);
break;
}
case Instruction::Select: {
@ -1233,7 +1233,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
Align = Q.DL.getABITypeAlignment(AI->getAllocatedType());
if (Align > 0)
KnownZero = APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align));
KnownZero.setLowBits(countTrailingZeros(Align));
break;
}
case Instruction::GetElementPtr: {
@ -1280,7 +1280,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
}
}
KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ);
KnownZero.setLowBits(TrailZ);
break;
}
case Instruction::PHI: {
@ -1321,9 +1321,8 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
APInt KnownZero3(KnownZero), KnownOne3(KnownOne);
computeKnownBits(L, KnownZero3, KnownOne3, Depth + 1, Q);
KnownZero = APInt::getLowBitsSet(
BitWidth, std::min(KnownZero2.countTrailingOnes(),
KnownZero3.countTrailingOnes()));
KnownZero.setLowBits(std::min(KnownZero2.countTrailingOnes(),
KnownZero3.countTrailingOnes()));
if (DontImproveNonNegativePhiBits)
break;
@ -1343,7 +1342,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
if (KnownZero2.isNegative() && KnownZero3.isNegative())
KnownZero.setSignBit();
else if (KnownOne2.isNegative() && KnownOne3.isNegative())
KnownOne.setBit(BitWidth - 1);
KnownOne.setSignBit();
}
// (sub nsw non-negative, negative) --> non-negative