diff options
| author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-24 12:20:24 +0100 |
|---|---|---|
| committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-24 12:37:52 +0100 |
| commit | 1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1 (patch) | |
| tree | 50d71ef83f27827f0acfe6708acdb46e159f7506 /compiler/optimizing/dead_code_elimination.cc | |
| parent | a12f729e7165780e73857e6248af0df00ad6ce2b (diff) | |
| download | art-1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1.tar.gz art-1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1.tar.bz2 art-1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1.zip | |
Recompute dominator tree after DCE.
bug:22031382
Change-Id: Ifebe169897b76872015e3ce0ed7d0a9662f80cef
Diffstat (limited to 'compiler/optimizing/dead_code_elimination.cc')
| -rw-r--r-- | compiler/optimizing/dead_code_elimination.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/optimizing/dead_code_elimination.cc b/compiler/optimizing/dead_code_elimination.cc index fdfe518e95..5de629d605 100644 --- a/compiler/optimizing/dead_code_elimination.cc +++ b/compiler/optimizing/dead_code_elimination.cc @@ -68,6 +68,7 @@ void HDeadCodeElimination::RemoveDeadBlocks() { ArenaBitVector affected_loops(allocator, graph_->GetBlocks().Size(), false); MarkReachableBlocks(graph_->GetEntryBlock(), &live_blocks); + bool removed_one_or_more_blocks = false; // Remove all dead blocks. Iterate in post order because removal needs the // block's chain of dominators and nested loops need to be updated from the @@ -84,9 +85,17 @@ void HDeadCodeElimination::RemoveDeadBlocks() { MaybeRecordDeadBlock(block); MarkLoopHeadersContaining(*block, &affected_loops); block->DisconnectAndDelete(); + removed_one_or_more_blocks = true; } } + // If we removed at least one block, we need to recompute the full + // dominator tree. + if (removed_one_or_more_blocks) { + graph_->ClearDominanceInformation(); + graph_->ComputeDominanceInformation(); + } + // Connect successive blocks created by dead branches. Order does not matter. for (HReversePostOrderIterator it(*graph_); !it.Done();) { HBasicBlock* block = it.Current(); |
