aboutsummaryrefslogtreecommitdiff
path: root/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
commit3faf9df08ff389028050bfbccbef571061bf7cc1 (patch)
tree7ba4b001420b0efb36e17feef5d462f5d0d18b20 /lib/Analysis/ValueTracking.cpp
parentead0d88ad7659dabd66cc3149af97d98256fca84 (diff)
Use a SmallVector instead of an array, since auto_ptr doesn't handle arrays
properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52390 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index e9c3badb6d..7b87cb62da 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/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