[llvm] r316266 - [ValueTracking] Remove unnecessary temporary APInt from computeNumSignBitsVectorConstant.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 21 09:35:42 PDT 2017
Author: ctopper
Date: Sat Oct 21 09:35:41 2017
New Revision: 316266
URL: http://llvm.org/viewvc/llvm-project?rev=316266&view=rev
Log:
[ValueTracking] Remove unnecessary temporary APInt from computeNumSignBitsVectorConstant.
We can just use getNumSignBits instead of inverting negative numbers.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=316266&r1=316265&r2=316266&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sat Oct 21 09:35:41 2017
@@ -2097,11 +2097,7 @@ static unsigned computeNumSignBitsVector
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;
More information about the llvm-commits
mailing list