aboutsummaryrefslogtreecommitdiff
path: root/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
commit12145f0339648426af2a33ed50c11de7cfcdbdf8 (patch)
tree9c6bfe21c74c327bbb74831708016e8d75ea3147 /lib/Analysis
parentaf8082206beb2a9ddaa7380e735d1ae1c221bce6 (diff)
Fix a crash in SimpliftDemandedBits of vectors of pointers.
PR14183. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ValueTracking.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 1d7f0692cb..2c3ac0e075 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/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);