Skip to content

Commit 04300b0

Browse files
author
Kyle Butt
committed
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
1 parent f2435b9 commit 04300b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: llvm/lib/CodeGen/MachineBlockPlacement.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,9 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
26402640
// there are no MachineLoops.
26412641
PreferredLoopExit = nullptr;
26422642

2643+
assert(BlockToChain.empty());
2644+
assert(ComputedEdges.empty());
2645+
26432646
if (TailDupPlacement) {
26442647
MPDT = &getAnalysis<MachinePostDominatorTree>();
26452648
unsigned TailDupSize = TailDupPlacementThreshold;
@@ -2649,8 +2652,6 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
26492652
precomputeTriangleChains();
26502653
}
26512654

2652-
assert(BlockToChain.empty());
2653-
26542655
buildCFGChains();
26552656

26562657
// Changing the layout can create new tail merging opportunities.
@@ -2671,6 +2672,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
26712672
/*AfterBlockPlacement=*/true)) {
26722673
// Redo the layout if tail merging creates/removes/moves blocks.
26732674
BlockToChain.clear();
2675+
ComputedEdges.clear();
26742676
// Must redo the post-dominator tree if blocks were changed.
26752677
if (MPDT)
26762678
MPDT->runOnMachineFunction(MF);
@@ -2683,6 +2685,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
26832685
alignBlocks();
26842686

26852687
BlockToChain.clear();
2688+
ComputedEdges.clear();
26862689
ChainAllocator.DestroyAll();
26872690

26882691
if (AlignAllBlock)

0 commit comments

Comments
 (0)