[InstCombine] Return replaceInstUsesWith() result (NFC)
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Aug 2020 12:49:57 +0000 (14:49 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Aug 2020 12:49:57 +0000 (14:49 +0200)
Follow the usual usage pattern for this function and return the
result.

llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

index 448b14e..4a7e50a 100644 (file)
@@ -1439,8 +1439,7 @@ Instruction *InstCombinerImpl::visitPHINode(PHINode &PN) {
         continue;
       // Just use that PHI instead then.
       ++NumPHICSEs;
-      replaceInstUsesWith(PN, &Src);
-      return &PN;
+      return replaceInstUsesWith(PN, &Src);
     }
   }
 
index 14de00f..7fd1f7d 100644 (file)
@@ -975,10 +975,7 @@ Instruction *InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(
     PHI->addIncoming(SourceAggregates[Pred], Pred);
 
   ++NumAggregateReconstructionsSimplified;
-  replaceInstUsesWith(OrigIVI, PHI);
-
-  // Just signal that the fold happened, we've already inserted instructions.
-  return &OrigIVI;
+  return replaceInstUsesWith(OrigIVI, PHI);
 }
 
 /// Try to find redundant insertvalue instructions, like the following ones: