[llvm-commits] [llvm] r170586 - /llvm/trunk/lib/Analysis/ValueTracking.cpp
Nadav Rotem
nrotem at apple.com
Wed Dec 19 12:47:04 PST 2012
Author: nadav
Date: Wed Dec 19 14:47:04 2012
New Revision: 170586
URL: http://llvm.org/viewvc/llvm-project?rev=170586&view=rev
Log:
Fix a bug that was found by building clang with -fsanitize.
I introduced it in r166785. PR14291.
If TD is unavailable use getScalarSizeInBits, but don't optimize
pointers or vectors of pointers.
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=170586&r1=170585&r2=170586&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Dec 19 14:47:04 2012
@@ -433,7 +433,12 @@
unsigned SrcBitWidth;
// Note that we handle pointer operands here because of inttoptr/ptrtoint
// which fall through here.
- SrcBitWidth = TD->getTypeSizeInBits(SrcTy->getScalarType());
+ if(TD) {
+ SrcBitWidth = TD->getTypeSizeInBits(SrcTy->getScalarType());
+ } else {
+ SrcBitWidth = SrcTy->getScalarSizeInBits();
+ if (!SrcBitWidth) return;
+ }
assert(SrcBitWidth && "SrcBitWidth can't be zero");
KnownZero = KnownZero.zextOrTrunc(SrcBitWidth);
More information about the llvm-commits
mailing list