From: Hal Finkel Date: Thu, 10 Jul 2014 06:06:11 +0000 (+0000) Subject: Fix isDereferenceablePointer not to try to take the size of an unsized type. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66e23f126d0ffe97f973903de45088ed22552b9e;p=platform%2Fupstream%2Fllvm.git Fix isDereferenceablePointer not to try to take the size of an unsized type. I'll add a test-case shortly. llvm-svn: 212687 --- diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index d61b8e5..35c241a 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(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)))