[llvm] 4f4eecf - [InstCombine] visitPHINode(): use InstCombiner::replaceInstUsesWith() instead of RAUW

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 05:11:11 PDT 2020


Author: Roman Lebedev
Date: 2020-08-29T15:10:00+03:00
New Revision: 4f4eecf0ec56a15b3dc377cac3799463cbf77a1f

URL: https://github.com/llvm/llvm-project/commit/4f4eecf0ec56a15b3dc377cac3799463cbf77a1f
DIFF: https://github.com/llvm/llvm-project/commit/4f4eecf0ec56a15b3dc377cac3799463cbf77a1f.diff

LOG: [InstCombine] visitPHINode(): use InstCombiner::replaceInstUsesWith() instead of RAUW

As noted in post-commit review, we really shouldn't use RAUW in InstCombine
because we should consistently update Worklist to avoid extra iterations.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index b63e7bff09eb..448b14ed35cc 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -1439,7 +1439,7 @@ Instruction *InstCombinerImpl::visitPHINode(PHINode &PN) {
         continue;
       // Just use that PHI instead then.
       ++NumPHICSEs;
-      PN.replaceAllUsesWith(&Src);
+      replaceInstUsesWith(PN, &Src);
       return &PN;
     }
   }


        


More information about the llvm-commits mailing list