summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2015-12-21 20:38:18 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2015-12-21 20:38:18 +0000
commit0c97988e54d08cf84c1da9301fa4495384a9fbc0 (patch)
treef39c860fcad523c7303068b1a83a1ce652958435 /llvm/lib/Analysis
parent51a62f15d84d961f7956f502710a90e30ebe0291 (diff)
downloadbcm5719-llvm-0c97988e54d08cf84c1da9301fa4495384a9fbc0.tar.gz
bcm5719-llvm-0c97988e54d08cf84c1da9301fa4495384a9fbc0.zip
[ValueTracking] Properly handle non-sized types in isAligned function.
Reviewers: apilipenko, reames, sanjoy, hfinkel Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15597 llvm-svn: 256192
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 358aa8ed895..314ec9c1886 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3179,6 +3179,8 @@ static bool isAligned(const Value *Base, APInt Offset, unsigned Align,
if (!BaseAlign) {
Type *Ty = Base->getType()->getPointerElementType();
+ if (!Ty->isSized())
+ return false;
BaseAlign = DL.getABITypeAlignment(Ty);
}
@@ -3189,7 +3191,9 @@ static bool isAligned(const Value *Base, APInt Offset, unsigned Align,
}
static bool isAligned(const Value *Base, unsigned Align, const DataLayout &DL) {
- APInt Offset(DL.getTypeStoreSizeInBits(Base->getType()), 0);
+ Type *Ty = Base->getType();
+ assert(Ty->isSized() && "must be sized");
+ APInt Offset(DL.getTypeStoreSizeInBits(Ty), 0);
return isAligned(Base, Offset, Align, DL);
}
OpenPOWER on IntegriCloud