aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
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
commit0e48803252804e067830eda616682708603876fa (patch)
tree4e075f9f766269cbcb127edc985750df4883e9d9 /llvm/lib/IR/ConstantFold.cpp
parent782609e1460ff6839112d793e62a7d8e9a152da2 (diff)
downloadllvm-0e48803252804e067830eda616682708603876fa.zip
llvm-0e48803252804e067830eda616682708603876fa.tar.gz
llvm-0e48803252804e067830eda616682708603876fa.tar.bz2
Fix a bug that was found by the clang static analyzer. The var "AT" is null so we cant deref it.
llvm-svn: 175550
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 587b7ce8..a5a9d9f 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/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);