[llvm] r224848 - ValueTracking: Small cleanup in ComputeNumSignBits
David Majnemer
david.majnemer at gmail.com
Fri Dec 26 01:20:17 PST 2014
Author: majnemer
Date: Fri Dec 26 03:20:17 2014
New Revision: 224848
URL: http://llvm.org/viewvc/llvm-project?rev=224848&view=rev
Log:
ValueTracking: Small cleanup in ComputeNumSignBits
Constant contains the isAllOnesValue and isNullValue predicates, not
ConstantInt.
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=224848&r1=224847&r2=224848&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Dec 26 03:20:17 2014
@@ -1768,7 +1768,7 @@ unsigned ComputeNumSignBits(Value *V, co
if (Tmp == 1) return 1; // Early out.
// Special case decrementing a value (ADD X, -1):
- if (ConstantInt *CRHS = dyn_cast<ConstantInt>(U->getOperand(1)))
+ if (const auto *CRHS = dyn_cast<Constant>(U->getOperand(1)))
if (CRHS->isAllOnesValue()) {
APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0);
computeKnownBits(U->getOperand(0), KnownZero, KnownOne, TD, Depth+1, Q);
@@ -1793,7 +1793,7 @@ unsigned ComputeNumSignBits(Value *V, co
if (Tmp2 == 1) return 1;
// Handle NEG.
- if (ConstantInt *CLHS = dyn_cast<ConstantInt>(U->getOperand(0)))
+ if (const auto *CLHS = dyn_cast<Constant>(U->getOperand(0)))
if (CLHS->isNullValue()) {
APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0);
computeKnownBits(U->getOperand(1), KnownZero, KnownOne, TD, Depth+1, Q);
More information about the llvm-commits
mailing list