[llvm] 6093b14 - [InstCombine] Return replaceInstUsesWith() result (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 05:50:45 PDT 2020


Author: Nikita Popov
Date: 2020-08-29T14:49:57+02:00
New Revision: 6093b14c2c1fc785bfb7040ecebfe4127e1ab9ab

URL: https://github.com/llvm/llvm-project/commit/6093b14c2c1fc785bfb7040ecebfe4127e1ab9ab
DIFF: https://github.com/llvm/llvm-project/commit/6093b14c2c1fc785bfb7040ecebfe4127e1ab9ab.diff

LOG: [InstCombine] Return replaceInstUsesWith() result (NFC)

Follow the usual usage pattern for this function and return the
result.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index 448b14ed35cc..4a7e50a312cb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -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);
     }
   }
 

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 14de00f2e15d..7fd1f7dc01f5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -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:


        


More information about the llvm-commits mailing list