summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-17 08:24:37 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-17 08:24:37 +0000
commit8369c67cbdfd101b94369fe300a46104f6087661 (patch)
tree23a53ebec7faefe73ecaf90d9e7bc4da1727f527 /llvm/lib/Analysis/ValueTracking.cpp
parentc07d000356d650a6da54e77cb7d17e5ce10f3e5b (diff)
downloadbcm5719-llvm-8369c67cbdfd101b94369fe300a46104f6087661.tar.gz
bcm5719-llvm-8369c67cbdfd101b94369fe300a46104f6087661.zip
Use a SmallVector instead of an array, since auto_ptr doesn't handle arrays
properly. llvm-svn: 52390
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e9c3badb6d1..7b87cb62da0 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -908,24 +908,21 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
// Calculate the number of indices required
unsigned size = I->getNumIndices() + (idx_end - idx_begin);
// Allocate some space to put the new indices in
- unsigned *new_begin = new unsigned[size];
- // Auto cleanup this array
- std::auto_ptr<unsigned> newptr(new_begin);
- // Start inserting at the beginning
- unsigned *new_end = new_begin;
+ SmallVector<unsigned, 5> Idxs;
+ Idxs.reserve(size);
// Add indices from the extract value instruction
for (const unsigned *i = I->idx_begin(), *e = I->idx_end();
- i != e; ++i, ++new_end)
- *new_end = *i;
+ i != e; ++i)
+ Idxs.push_back(*i);
// Add requested indices
- for (const unsigned *i = idx_begin, *e = idx_end; i != e; ++i, ++new_end)
- *new_end = *i;
+ for (const unsigned *i = idx_begin, *e = idx_end; i != e; ++i)
+ Idxs.push_back(*i);
- assert((unsigned)(new_end - new_begin) == size
+ assert(Idxs.size() == size
&& "Number of indices added not correct?");
- return FindInsertedValue(I->getAggregateOperand(), new_begin, new_end,
+ return FindInsertedValue(I->getAggregateOperand(), Idxs.begin(), Idxs.end(),
InsertBefore);
}
// Otherwise, we don't know (such as, extracting from a function return value
OpenPOWER on IntegriCloud