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://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5ee0267e4931378841066abc7aa8dec7f1d82abb;p=oota-llvm.git Fix isDereferenceablePointer not to try to take the size of an unsized type. I'll add a test-case shortly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212687 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp index d61b8e52ea8..35c241a608b 100644 --- a/lib/IR/Value.cpp +++ b/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)))