[llvm-commits] CVS: llvm/tools/bugpoint/CodeGeneratorBug.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 19 16:49:01 PDT 2003


Changes in directory llvm/tools/bugpoint:

CodeGeneratorBug.cpp updated: 1.24 -> 1.25

---
Log message:

Fix iterator invalidation problem


---
Diffs of the changes:  (+2 -3)

Index: llvm/tools/bugpoint/CodeGeneratorBug.cpp
diff -u llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.24 llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.25
--- llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.24	Sat Oct 18 16:55:47 2003
+++ llvm/tools/bugpoint/CodeGeneratorBug.cpp	Sun Oct 19 16:48:27 2003
@@ -144,8 +144,8 @@
         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 @@
             std::cerr << "Non-instruction is using an external function!\n";
             abort();
           }
-        }
       }
     }
   }





More information about the llvm-commits mailing list