[llvm] r300022 - CodeGen: BlockPlacement: Clear ComputedEdges between functions.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 20:18:21 PDT 2017


Author: iteratee
Date: Tue Apr 11 22:18:20 2017
New Revision: 300022

URL: http://llvm.org/viewvc/llvm-project?rev=300022&view=rev
Log:
CodeGen: BlockPlacement: Clear ComputedEdges between functions.

Not clearing was causing non-deterministic compiles for large files. Addresses
for MachineBasicBlocks would end up colliding and we would lay out a block that
we assumed had been pre-computed when it had not been.

Modified:
    llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=300022&r1=300021&r2=300022&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Tue Apr 11 22:18:20 2017
@@ -2640,6 +2640,9 @@ bool MachineBlockPlacement::runOnMachine
   // there are no MachineLoops.
   PreferredLoopExit = nullptr;
 
+  assert(BlockToChain.empty());
+  assert(ComputedEdges.empty());
+
   if (TailDupPlacement) {
     MPDT = &getAnalysis<MachinePostDominatorTree>();
     unsigned TailDupSize = TailDupPlacementThreshold;
@@ -2649,8 +2652,6 @@ bool MachineBlockPlacement::runOnMachine
     precomputeTriangleChains();
   }
 
-  assert(BlockToChain.empty());
-
   buildCFGChains();
 
   // Changing the layout can create new tail merging opportunities.
@@ -2671,6 +2672,7 @@ bool MachineBlockPlacement::runOnMachine
                             /*AfterBlockPlacement=*/true)) {
       // Redo the layout if tail merging creates/removes/moves blocks.
       BlockToChain.clear();
+      ComputedEdges.clear();
       // Must redo the post-dominator tree if blocks were changed.
       if (MPDT)
         MPDT->runOnMachineFunction(MF);
@@ -2683,6 +2685,7 @@ bool MachineBlockPlacement::runOnMachine
   alignBlocks();
 
   BlockToChain.clear();
+  ComputedEdges.clear();
   ChainAllocator.DestroyAll();
 
   if (AlignAllBlock)




More information about the llvm-commits mailing list