summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/CodeGeneratorBug.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-19 21:48:27 +0000
committerChris Lattner <sabre@nondot.org>2003-10-19 21:48:27 +0000
commita4004f6678d729dae1f05236054ef7dc56bf94a4 (patch)
tree968fd1d21aa55679d3545efeb587d968365fb2b9 /llvm/tools/bugpoint/CodeGeneratorBug.cpp
parent24c67e85530c1db1bf8b7099557bee944b60a1a6 (diff)
downloadbcm5719-llvm-a4004f6678d729dae1f05236054ef7dc56bf94a4.tar.gz
bcm5719-llvm-a4004f6678d729dae1f05236054ef7dc56bf94a4.zip
Fix iterator invalidation problem
llvm-svn: 9272
Diffstat (limited to 'llvm/tools/bugpoint/CodeGeneratorBug.cpp')
-rw-r--r--llvm/tools/bugpoint/CodeGeneratorBug.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/tools/bugpoint/CodeGeneratorBug.cpp b/llvm/tools/bugpoint/CodeGeneratorBug.cpp
index 10f544a69ad..0aea9b031da 100644
--- a/llvm/tools/bugpoint/CodeGeneratorBug.cpp
+++ b/llvm/tools/bugpoint/CodeGeneratorBug.cpp
@@ -144,8 +144,8 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
ResolverArgs.push_back(GEP);
// Insert code at the beginning of the function
- for (Value::use_iterator i=F->use_begin(), e=F->use_end(); i!=e; ++i) {
- if (Instruction* Inst = dyn_cast<Instruction>(*i)) {
+ while (!F->use_empty())
+ if (Instruction *Inst = dyn_cast<Instruction>(F->use_back())) {
// call resolver(GetElementPtr...)
CallInst *resolve = new CallInst(resolverFunc, ResolverArgs,
"resolver", Inst);
@@ -161,7 +161,6 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
std::cerr << "Non-instruction is using an external function!\n";
abort();
}
- }
}
}
}
OpenPOWER on IntegriCloud