[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ConstantProp.cpp DCE.cpp InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Apr 27 10:12:07 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

ConstantProp.cpp updated: 1.47 -> 1.48
DCE.cpp updated: 1.52 -> 1.53
InstructionCombining.cpp updated: 1.193 -> 1.194

---
Log message:

Changes to fix up the inst_iterator to pass to boost iterator checks.  This 
patch was graciously contributed by Vladimir Prus.


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

Index: llvm/lib/Transforms/Scalar/ConstantProp.cpp
diff -u llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.47 llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.48
--- llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.47	Tue Apr 13 14:28:20 2004
+++ llvm/lib/Transforms/Scalar/ConstantProp.cpp	Tue Apr 27 10:12:22 2004
@@ -49,7 +49,10 @@
 
 bool ConstantPropagation::runOnFunction(Function &F) {
   // Initialize the worklist to all of the instructions ready to process...
-  std::set<Instruction*> WorkList(inst_begin(F), inst_end(F));
+  std::set<Instruction*> WorkList;
+  for(inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
+      WorkList.insert(&*i);
+  }
   bool Changed = false;
 
   while (!WorkList.empty()) {


Index: llvm/lib/Transforms/Scalar/DCE.cpp
diff -u llvm/lib/Transforms/Scalar/DCE.cpp:1.52 llvm/lib/Transforms/Scalar/DCE.cpp:1.53
--- llvm/lib/Transforms/Scalar/DCE.cpp:1.52	Wed Apr 21 17:29:37 2004
+++ llvm/lib/Transforms/Scalar/DCE.cpp	Tue Apr 27 10:12:23 2004
@@ -76,7 +76,10 @@
 
 bool DCE::runOnFunction(Function &F) {
   // Start out with all of the instructions in the worklist...
-  std::vector<Instruction*> WorkList(inst_begin(F), inst_end(F));
+  std::vector<Instruction*> WorkList;
+  for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
+      WorkList.push_back(&*i);
+  }
   std::set<Instruction*> DeadInsts;
   
   // Loop over the worklist finding instructions that are dead.  If they are


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.193 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.194
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.193	Mon Apr 26 09:01:59 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Apr 27 10:12:23 2004
@@ -2934,7 +2934,10 @@
   bool Changed = false;
   TD = &getAnalysis<TargetData>();
 
-  WorkList.insert(WorkList.end(), inst_begin(F), inst_end(F));
+  for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
+      WorkList.push_back(&*i);
+  }
+
 
   while (!WorkList.empty()) {
     Instruction *I = WorkList.back();  // Get an instruction from the worklist





More information about the llvm-commits mailing list