[llvm] r330399 - [SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 00:57:25 PDT 2018


Author: mzolotukhin
Date: Fri Apr 20 00:57:24 2018
New Revision: 330399

URL: http://llvm.org/viewvc/llvm-project?rev=330399&view=rev
Log:
[SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.

Modified:
    llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp?rev=330399&r1=330398&r2=330399&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp Fri Apr 20 00:57:24 2018
@@ -90,7 +90,8 @@ Value *SSAUpdaterBulk::computeValueAt(Ba
 static void
 ComputeLiveInBlocks(const SmallPtrSetImpl<BasicBlock *> &UsingBlocks,
                     const SmallPtrSetImpl<BasicBlock *> &DefBlocks,
-                    SmallPtrSetImpl<BasicBlock *> &LiveInBlocks) {
+                    SmallPtrSetImpl<BasicBlock *> &LiveInBlocks,
+                    PredIteratorCache &PredCache) {
   // To determine liveness, we must iterate through the predecessors of blocks
   // where the def is live.  Blocks are added to the worklist if we need to
   // check their predecessors.  Start with all the using blocks.
@@ -110,7 +111,7 @@ ComputeLiveInBlocks(const SmallPtrSetImp
     // Since the value is live into BB, it is either defined in a predecessor or
     // live into it to.  Add the preds to the worklist unless they are a
     // defining block.
-    for (BasicBlock *P : predecessors(BB)) {
+    for (BasicBlock *P : PredCache.get(BB)) {
       // The value is not live into a predecessor if it defines the value.
       if (DefBlocks.count(P))
         continue;
@@ -147,7 +148,7 @@ void SSAUpdaterBulk::RewriteAllUses(Domi
 
     SmallVector<BasicBlock *, 32> IDFBlocks;
     SmallPtrSet<BasicBlock *, 32> LiveInBlocks;
-    ComputeLiveInBlocks(UsingBlocks, DefBlocks, LiveInBlocks);
+    ComputeLiveInBlocks(UsingBlocks, DefBlocks, LiveInBlocks, PredCache);
     IDF.resetLiveInBlocks();
     IDF.setLiveInBlocks(LiveInBlocks);
     IDF.calculate(IDFBlocks);




More information about the llvm-commits mailing list