From 8c160548ce58c87242335b041f80e1b97f974823 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Wed, 8 Feb 2012 14:10:53 +0000 Subject: [PATCH] Use Use::set rather than finding the operand number of the use and setting that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150074 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVN.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 654125342a4..5b95f5b86fb 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1900,12 +1900,9 @@ unsigned GVN::replaceAllDominatedUsesWith(Value *From, Value *To, unsigned Count = 0; for (Value::use_iterator UI = From->use_begin(), UE = From->use_end(); UI != UE; ) { - Instruction *User = cast(*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(U.getUser())->getParent())) { + U.set(To); ++Count; } } -- 2.34.1