forked from OSchip/llvm-project
[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:
parent
b98ee58511
commit
8e8b6efdc8
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue