We can just use getNumSignBits instead of inverting negative numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316266
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!Elt)
return 0;
- // If the sign bit is 1, flip the bits, so we always count leading zeros.
- APInt EltVal = Elt->getValue();
- if (EltVal.isNegative())
- EltVal = ~EltVal;
- MinSignBits = std::min(MinSignBits, EltVal.countLeadingZeros());
+ MinSignBits = std::min(MinSignBits, Elt->getValue().getNumSignBits());
}
return MinSignBits;