This code really wants to iterate over the OPERANDS of an instruction, not
authorChris Lattner <sabre@nondot.org>
Wed, 21 Apr 2004 22:29:37 +0000 (22:29 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 21 Apr 2004 22:29:37 +0000 (22:29 +0000)
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.  :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13102 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/DCE.cpp

index 8d0b1db650235edfe6fad30e6acfe3b39d0f848a..36e662ac2fbbbb8b4ccb4fcf4f9084d7aad9f3a6 100644 (file)
@@ -92,9 +92,8 @@ bool DCE::runOnFunction(Function &F) {
       // 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...