[llvm-commits] [llvm] r166785 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
Nadav Rotem
nrotem at apple.com
Fri Oct 26 10:17:05 PDT 2012
Author: nadav
Date: Fri Oct 26 12:17:05 2012
New Revision: 166785
URL: http://llvm.org/viewvc/llvm-project?rev=166785&view=rev
Log:
Fix a crash in SimpliftDemandedBits of vectors of pointers.
PR14183.
Added:
llvm/trunk/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
- copied unchanged from r166738, llvm/trunk/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
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=166785&r1=166784&r2=166785&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Oct 26 12:17:05 2012
@@ -430,15 +430,13 @@
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);
More information about the llvm-commits
mailing list