diff options
author | Vladimir Marko <vmarko@google.com> | 2014-12-08 15:16:54 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2014-12-08 15:37:05 +0000 |
commit | cb873d8fd06b7dde4b69c5987b4eaf541d345a50 (patch) | |
tree | 3e1614c8e57dfd262817512233319dd9ad526754 /compiler/dex/mir_graph.cc | |
parent | 1495a8e6409238bca28a33fd47913e382a85ea79 (diff) | |
download | art-cb873d8fd06b7dde4b69c5987b4eaf541d345a50.tar.gz art-cb873d8fd06b7dde4b69c5987b4eaf541d345a50.tar.bz2 art-cb873d8fd06b7dde4b69c5987b4eaf541d345a50.zip |
Quick: Kill unreachable blocks instead of just hiding them.
This changes the block type from kDalvikByteCode to kDead
and properly cleans up predecessors and MIRGraph::catches_.
Bug: 18626174
Change-Id: I268bf68f7947604bcb82caf95ee79c6831ee6e2a
Diffstat (limited to 'compiler/dex/mir_graph.cc')
-rw-r--r-- | compiler/dex/mir_graph.cc | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index 023abca64e..4ab083caba 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -2222,21 +2222,7 @@ void BasicBlock::ResetOptimizationFlags(uint16_t reset_flags) { } } -void BasicBlock::Hide(MIRGraph* mir_graph) { - // First lets make it a dalvik bytecode block so it doesn't have any special meaning. - block_type = kDalvikByteCode; - - // Mark it as hidden. - hidden = true; - - // Detach it from its MIRs so we don't generate code for them. Also detached MIRs - // are updated to know that they no longer have a parent. - for (MIR* mir = first_mir_insn; mir != nullptr; mir = mir->next) { - mir->bb = NullBasicBlockId; - } - first_mir_insn = nullptr; - last_mir_insn = nullptr; - +void BasicBlock::Kill(MIRGraph* mir_graph) { for (BasicBlockId pred_id : predecessors) { BasicBlock* pred_bb = mir_graph->GetBasicBlock(pred_id); DCHECK(pred_bb != nullptr); @@ -2244,24 +2230,11 @@ void BasicBlock::Hide(MIRGraph* mir_graph) { // Sadly we have to go through the children by hand here. pred_bb->ReplaceChild(id, NullBasicBlockId); } + predecessors.clear(); - // Iterate through children of bb we are hiding. - ChildBlockIterator successorChildIter(this, mir_graph); - - for (BasicBlock* childPtr = successorChildIter.Next(); childPtr != 0; childPtr = successorChildIter.Next()) { - // Erase this predecessor from child. - childPtr->ErasePredecessor(id); - } - - // Remove link to children. - taken = NullBasicBlockId; - fall_through = NullBasicBlockId; - successor_block_list_type = kNotUsed; + KillUnreachable(mir_graph); } -/* - * Kill an unreachable block and all blocks that become unreachable by killing this one. - */ void BasicBlock::KillUnreachable(MIRGraph* mir_graph) { DCHECK(predecessors.empty()); // Unreachable. |