aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-02-19 19:36:59 +0000
committerNadav Rotem <nrotem@apple.com>2013-02-19 19:36:59 +0000
commita175396816a9b28835acfe2cd07250881f1fee6c (patch)
tree44c73c863222d272665e6e47fb9a89827b302eee
parenta8eae3e35866329f2191a22a34421faa61448508 (diff)
downloadexternal_llvm-a175396816a9b28835acfe2cd07250881f1fee6c.zip
external_llvm-a175396816a9b28835acfe2cd07250881f1fee6c.tar.gz
external_llvm-a175396816a9b28835acfe2cd07250881f1fee6c.tar.bz2
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
-rw-r--r--lib/IR/ConstantFold.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/IR/ConstantFold.cpp b/lib/IR/ConstantFold.cpp
index 587b7ce..a5a9d9f 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<ArrayType>(Agg->getType()))
NumElts = AT->getNumElements();
else
- NumElts = AT->getVectorNumElements();
-
+ NumElts = Agg->getType()->getVectorNumElements();
+
SmallVector<Constant*, 32> Result;
for (unsigned i = 0; i != NumElts; ++i) {
Constant *C = Agg->getAggregateElement(i);