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.

llvm-svn: 300022
This commit is contained in:
Kyle Butt 2017-04-12 03:18:20 +00:00
parent f2435b9574
commit 04300b033e
1 changed files with 5 additions and 2 deletions

View File

@ -2640,6 +2640,9 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
// there are no MachineLoops. // there are no MachineLoops.
PreferredLoopExit = nullptr; PreferredLoopExit = nullptr;
assert(BlockToChain.empty());
assert(ComputedEdges.empty());
if (TailDupPlacement) { if (TailDupPlacement) {
MPDT = &getAnalysis<MachinePostDominatorTree>(); MPDT = &getAnalysis<MachinePostDominatorTree>();
unsigned TailDupSize = TailDupPlacementThreshold; unsigned TailDupSize = TailDupPlacementThreshold;
@ -2649,8 +2652,6 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
precomputeTriangleChains(); precomputeTriangleChains();
} }
assert(BlockToChain.empty());
buildCFGChains(); buildCFGChains();
// Changing the layout can create new tail merging opportunities. // Changing the layout can create new tail merging opportunities.
@ -2671,6 +2672,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
/*AfterBlockPlacement=*/true)) { /*AfterBlockPlacement=*/true)) {
// Redo the layout if tail merging creates/removes/moves blocks. // Redo the layout if tail merging creates/removes/moves blocks.
BlockToChain.clear(); BlockToChain.clear();
ComputedEdges.clear();
// Must redo the post-dominator tree if blocks were changed. // Must redo the post-dominator tree if blocks were changed.
if (MPDT) if (MPDT)
MPDT->runOnMachineFunction(MF); MPDT->runOnMachineFunction(MF);
@ -2683,6 +2685,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
alignBlocks(); alignBlocks();
BlockToChain.clear(); BlockToChain.clear();
ComputedEdges.clear();
ChainAllocator.DestroyAll(); ChainAllocator.DestroyAll();
if (AlignAllBlock) if (AlignAllBlock)