[llvm-commits] [llvm] r150074 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Duncan Sands baldrick at free.fr
Wed Feb 8 06:10:53 PST 2012


Author: baldrick
Date: Wed Feb  8 08:10:53 2012
New Revision: 150074

URL: http://llvm.org/viewvc/llvm-project?rev=150074&view=rev
Log:
Use Use::set rather than finding the operand number of the use
and setting that.

Modified:
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=150074&r1=150073&r2=150074&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Feb  8 08:10:53 2012
@@ -1900,12 +1900,9 @@
   unsigned Count = 0;
   for (Value::use_iterator UI = From->use_begin(), UE = From->use_end();
        UI != UE; ) {
-    Instruction *User = cast<Instruction>(*UI);
-    unsigned OpNum = UI.getOperandNo();
-    ++UI;
-
-    if (DT->dominates(Root, User->getParent())) {
-      User->setOperand(OpNum, To);
+    Use &U = (UI++).getUse();
+    if (DT->dominates(Root, cast<Instruction>(U.getUser())->getParent())) {
+      U.set(To);
       ++Count;
     }
   }





More information about the llvm-commits mailing list