summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-10-26 17:17:05 +0000
committerNadav Rotem <nrotem@apple.com>2012-10-26 17:17:05 +0000
commit15198e94d2faab4f7b0afd8c82a84f2688820ae9 (patch)
tree29e9d9d756bf018c8886195acd2fed110c8dd74f /llvm/lib/Analysis
parent6fe7acab9d38654f19e0a404e60c3a4a985f0c30 (diff)
downloadbcm5719-llvm-15198e94d2faab4f7b0afd8c82a84f2688820ae9.tar.gz
bcm5719-llvm-15198e94d2faab4f7b0afd8c82a84f2688820ae9.zip
Fix a crash in SimpliftDemandedBits of vectors of pointers.
PR14183. llvm-svn: 166785
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 1d7f0692cbe..2c3ac0e0756 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -430,15 +430,13 @@ void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
case Instruction::ZExt:
case Instruction::Trunc: {
Type *SrcTy = I->getOperand(0)->getType();
-
+
unsigned SrcBitWidth;
// Note that we handle pointer operands here because of inttoptr/ptrtoint
// which fall through here.
- if (SrcTy->isPointerTy())
- SrcBitWidth = TD->getTypeSizeInBits(SrcTy);
- else
- SrcBitWidth = SrcTy->getScalarSizeInBits();
-
+ SrcBitWidth = TD->getTypeSizeInBits(SrcTy->getScalarType());
+
+ assert(SrcBitWidth && "SrcBitWidth can't be zero");
KnownZero = KnownZero.zextOrTrunc(SrcBitWidth);
KnownOne = KnownOne.zextOrTrunc(SrcBitWidth);
ComputeMaskedBits(I->getOperand(0), KnownZero, KnownOne, TD, Depth+1);
OpenPOWER on IntegriCloud