[InstCombine] foldAggregateConstructionIntoAggregateReuse(): use InstCombiner::replac...
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 29 Aug 2020 12:04:07 +0000 (15:04 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 29 Aug 2020 12:10:14 +0000 (15:10 +0300)
We really shouldn't use RAUW in InstCombine
because we should consistently update Worklist to avoid extra iterations.

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

index 5cd1822..14de00f 100644 (file)
@@ -975,7 +975,7 @@ Instruction *InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(
     PHI->addIncoming(SourceAggregates[Pred], Pred);
 
   ++NumAggregateReconstructionsSimplified;
-  OrigIVI.replaceAllUsesWith(PHI);
+  replaceInstUsesWith(OrigIVI, PHI);
 
   // Just signal that the fold happened, we've already inserted instructions.
   return &OrigIVI;