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

Chris Lattner lattner at cs.uiuc.edu
Wed Apr 21 17:30:02 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

DCE.cpp updated: 1.51 -> 1.52

---
Log message:

This code really wants to iterate over the OPERANDS of an instruction, not
over its USES.  If it's dead it doesn't have any uses!  :)

Thanks to the fabulous and mysterious Bill Wendling for pointing this out.  :)


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

Index: llvm/lib/Transforms/Scalar/DCE.cpp
diff -u llvm/lib/Transforms/Scalar/DCE.cpp:1.51 llvm/lib/Transforms/Scalar/DCE.cpp:1.52
--- llvm/lib/Transforms/Scalar/DCE.cpp:1.51	Fri Jan  9 00:02:20 2004
+++ llvm/lib/Transforms/Scalar/DCE.cpp	Wed Apr 21 17:29:37 2004
@@ -92,9 +92,8 @@
       // instructions being used, add them to the worklist, because they might
       // go dead after this one is removed.
       //
-      for (User::use_iterator UI = I->use_begin(), UE = I->use_end();
-           UI != UE; ++UI)
-        if (Instruction *Used = dyn_cast<Instruction>(*UI))
+      for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI)
+        if (Instruction *Used = dyn_cast<Instruction>(*OI))
           WorkList.push_back(Used);
 
       // Tell the instruction to let go of all of the values it uses...





More information about the llvm-commits mailing list