diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2014-07-10 06:06:11 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2014-07-10 06:06:11 +0000 |
| commit | 66e23f126d0ffe97f973903de45088ed22552b9e (patch) | |
| tree | 15e8b2512be754c89e60de6d849aa53760fc6836 /llvm/lib/IR/Value.cpp | |
| parent | 2e42c34d058e5b068ec1cd6dae6cd388937c6e3c (diff) | |
| download | bcm5719-llvm-66e23f126d0ffe97f973903de45088ed22552b9e.tar.gz bcm5719-llvm-66e23f126d0ffe97f973903de45088ed22552b9e.zip | |
Fix isDereferenceablePointer not to try to take the size of an unsized type.
I'll add a test-case shortly.
llvm-svn: 212687
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
| -rw-r--r-- | llvm/lib/IR/Value.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index d61b8e52ea8..35c241a608b 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -492,7 +492,8 @@ static bool isDereferenceablePointer(const Value *V, const DataLayout *DL, if (const BitCastInst* BC = dyn_cast<BitCastInst>(V)) { Type *STy = BC->getSrcTy()->getPointerElementType(), *DTy = BC->getDestTy()->getPointerElementType(); - if ((DL->getTypeStoreSize(STy) >= + if (STy->isSized() && DTy->isSized() && + (DL->getTypeStoreSize(STy) >= DL->getTypeStoreSize(DTy)) && (DL->getABITypeAlignment(STy) >= DL->getABITypeAlignment(DTy))) |

