From: Nadav Rotem Date: Tue, 19 Feb 2013 19:36:59 +0000 (+0000) Subject: Fix a bug that was found by the clang static analyzer. The var "AT" is null so we... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a175396816a9b28835acfe2cd07250881f1fee6c;p=oota-llvm.git Fix a bug that was found by the clang static analyzer. The var "AT" is null so we cant deref it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175550 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/ConstantFold.cpp b/lib/IR/ConstantFold.cpp index 587b7ce88a9..a5a9d9f3a7c 100644 --- a/lib/IR/ConstantFold.cpp +++ b/lib/IR/ConstantFold.cpp @@ -846,8 +846,8 @@ Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg, else if (ArrayType *AT = dyn_cast(Agg->getType())) NumElts = AT->getNumElements(); else - NumElts = AT->getVectorNumElements(); - + NumElts = Agg->getType()->getVectorNumElements(); + SmallVector Result; for (unsigned i = 0; i != NumElts; ++i) { Constant *C = Agg->getAggregateElement(i);