[ValueTracking] Remove unnecessary temporary APInt from computeNumSignBitsVectorConstant.

We can just use getNumSignBits instead of inverting negative numbers.

llvm-svn: 316266
This commit is contained in:
Craig Topper 2017-10-21 16:35:41 +00:00
parent b98ee58511
commit 8e8b6efdc8
1 changed files with 1 additions and 5 deletions

View File

@ -2097,11 +2097,7 @@ static unsigned computeNumSignBitsVectorConstant(const Value *V,
if (!Elt) if (!Elt)
return 0; return 0;
// If the sign bit is 1, flip the bits, so we always count leading zeros. MinSignBits = std::min(MinSignBits, Elt->getValue().getNumSignBits());
APInt EltVal = Elt->getValue();
if (EltVal.isNegative())
EltVal = ~EltVal;
MinSignBits = std::min(MinSignBits, EltVal.countLeadingZeros());
} }
return MinSignBits; return MinSignBits;