summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-16 13:28:31 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-16 13:28:31 +0000
commit69801d4fd105af4059a547760c28e168b4ab0868 (patch)
tree1a55fbc7dc8392f9bf8768623965801dfa7d30fe /llvm/lib/Analysis/ValueTracking.cpp
parent86cda9e0506c21910edd0504309dcb028bb867cb (diff)
downloadbcm5719-llvm-69801d4fd105af4059a547760c28e168b4ab0868.tar.gz
bcm5719-llvm-69801d4fd105af4059a547760c28e168b4ab0868.zip
Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
llvm-svn: 52319
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 64cdc246b91..925185793d7 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -805,6 +805,7 @@ Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,
// Any inserted instructions are inserted before InsertBefore
Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,
const unsigned *idx_end, Instruction *InsertBefore) {
+ assert(InsertBefore && "Must have someplace to insert!");
const Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
idx_begin,
idx_end);
@@ -851,9 +852,13 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
for (const unsigned *i = I->idx_begin(), *e = I->idx_end();
i != e; ++i, ++req_idx) {
if (req_idx == idx_end)
- // The requested index is a part of a nested aggregate. Handle this
- // specially.
- return BuildSubAggregate(V, idx_begin, req_idx, InsertBefore);
+ if (InsertBefore)
+ // The requested index is a part of a nested aggregate. Handle this
+ // specially.
+ return BuildSubAggregate(V, idx_begin, req_idx, InsertBefore);
+ else
+ // We can't handle this without inserting insertvalues
+ return 0;
// This insert value inserts something else than what we are looking for.
// See if the (aggregrate) value inserted into has the value we are
OpenPOWER on IntegriCloud