]> granicus.if.org Git - llvm/commitdiff
[MemorySSA] Update DomTree before applying MSSA updates.
authorAlina Sbirlea <asbirlea@google.com>
Tue, 15 Oct 2019 17:15:19 +0000 (17:15 +0000)
committerAlina Sbirlea <asbirlea@google.com>
Tue, 15 Oct 2019 17:15:19 +0000 (17:15 +0000)
Update on the fix in rL374850.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374918 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

index fa9dbe240bafea502b9adcbc3d6fd298d9e4502f..e7621de82ff434f0670e79b7fd30960493502f7a 100644 (file)
@@ -2140,25 +2140,22 @@ static void unswitchNontrivialInvariants(
     // the branch in the split block.
     buildPartialUnswitchConditionalBranch(*SplitBB, Invariants, Direction,
                                           *ClonedPH, *LoopPH);
+    DTUpdates.push_back({DominatorTree::Insert, SplitBB, ClonedPH});
+
     if (MSSAU) {
+      DT.applyUpdates(DTUpdates);
+      DTUpdates.clear();
+
       // Perform MSSA cloning updates.
       for (auto &VMap : VMaps)
         MSSAU->updateForClonedLoop(LBRPO, ExitBlocks, *VMap,
                                    /*IgnoreIncomingWithNoClones=*/true);
       MSSAU->updateExitBlocksForClonedLoop(ExitBlocks, VMaps, DT);
     }
-    DTUpdates.push_back({DominatorTree::Insert, SplitBB, ClonedPH});
   }
 
   // Apply the updates accumulated above to get an up-to-date dominator tree.
   DT.applyUpdates(DTUpdates);
-  if (!FullUnswitch && MSSAU) {
-    // Update MSSA for partial unswitch, after DT update.
-    SmallVector<CFGUpdate, 1> Updates;
-    Updates.push_back(
-        {cfg::UpdateKind::Insert, SplitBB, ClonedPHs.begin()->second});
-    MSSAU->applyInsertUpdates(Updates, DT);
-  }
 
   // Now that we have an accurate dominator tree, first delete the dead cloned
   // blocks so that we can accurately build any cloned loops. It is important to