[InstCombine] Use replaceOperand() in descaling
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 30 Mar 2020 19:31:00 +0000 (21:31 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 31 Mar 2020 20:05:53 +0000 (22:05 +0200)
To make sure the old operand gets DCEd.

NFC apart from worklist order.

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

index d7798bd..6879766 100644 (file)
@@ -1481,7 +1481,7 @@ Value *InstCombiner::Descale(Value *Val, APInt Scale, bool &NoSignedWrap) {
   assert(Parent.first->hasOneUse() && "Drilled down when more than one use!");
   assert(Op != Parent.first->getOperand(Parent.second) &&
          "Descaling was a no-op?");
-  Parent.first->setOperand(Parent.second, Op);
+  replaceOperand(*Parent.first, Parent.second, Op);
   Worklist.push(Parent.first);
 
   // Now work back up the expression correcting nsw flags.  The logic is based