summaryrefslogtreecommitdiff
path: root/tools
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
commitb656c20cf1e09dbf8ba6dabaaba423790c7a0fa8 (patch)
treedcd26665260bde38a55169200858df20c72c3954 /tools
parenta626e0242e4dacdb5c98eb77b38eda5d99f411b0 (diff)
downloadllvm-b656c20cf1e09dbf8ba6dabaaba423790c7a0fa8.tar.gz
llvm-b656c20cf1e09dbf8ba6dabaaba423790c7a0fa8.tar.bz2
llvm-b656c20cf1e09dbf8ba6dabaaba423790c7a0fa8.tar.xz
Fix iterator invalidation problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/bugpoint/CodeGeneratorBug.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/bugpoint/CodeGeneratorBug.cpp b/tools/bugpoint/CodeGeneratorBug.cpp
index 10f544a69a..0aea9b031d 100644
--- a/tools/bugpoint/CodeGeneratorBug.cpp
+++ b/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();
}
- }
}
}
}