From 31242a99a1b58ce5267c1a74ad96a9d0b6dc1a94 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Mon, 5 Dec 2022 14:38:00 +0000 Subject: Update domination chain and RPO manually in MaybeAddExtraGotoBlocks There's no need to recompute the whole graph as we know what changed. As a drive-by, we now don't return false for graphs with irreducible loops so we can remove that restriction from the builder. However, if a graph with irreducible loops hits this path it means that: A) it's being inlined B) Has irreducible loops We don't inline graphs with irreducible loops, and after building for inline we don't remove them either because constant folding and instruction simplifier don't remove them, and DCE doesn't run for graphs with irreducible loops. So, in terms of dex2oat's outputs nothing should change. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I8cbf1b5f0518bb5dd14ffd751100ea81f5478863 --- compiler/optimizing/nodes.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 841576a5e5..4a0ec93663 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -569,6 +569,15 @@ void HGraph::SplitCriticalEdge(HBasicBlock* block, HBasicBlock* successor) { } } +HBasicBlock* HGraph::SplitEdgeAndUpdateRPO(HBasicBlock* block, HBasicBlock* successor) { + HBasicBlock* new_block = SplitEdge(block, successor); + // In the RPO we have {... , block, ... , successor}. We want to insert `new_block` right after + // `block` to have a consistent RPO without recomputing the whole graph's RPO. + reverse_post_order_.insert( + reverse_post_order_.begin() + IndexOfElement(reverse_post_order_, block) + 1, new_block); + return new_block; +} + // Reorder phi inputs to match reordering of the block's predecessors. static void FixPhisAfterPredecessorsReodering(HBasicBlock* block, size_t first, size_t second) { for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { -- cgit v1.2.3-59-g8ed1b