From 78f3d3a7b2d795cc0915218abafb0d5b47aa2225 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Fri, 15 Jul 2022 14:30:05 +0100 Subject: Improve DCE's SimplifyAlwaysThrows regarding Invoke location Allow SimplifyAlwaysThrows to run on any invoke that always throws, and not just the second to last instruction. As a bonus, there are two places that would make a graph have invokes that always throws: 1) When inlining a method that has invokes that always throw. 2) When trying to inline a method, and not doing it since it always throws. Since we only have those two places, we can add a flag to the graph that tracks this. We then skip the SimplifyAlwaysThrows optimization altogether if the graph doesn't have that flag set. Bug: 227316307 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ia353fcf2c055885cc04e10790584210c2e488e32 --- compiler/optimizing/nodes.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 90c8f748a5..ba6d1a7da2 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -2108,8 +2108,9 @@ void HInstruction::MoveBeforeFirstUserAndOutOfLoops() { MoveBefore(insert_pos); } -HBasicBlock* HBasicBlock::SplitBefore(HInstruction* cursor) { - DCHECK(!graph_->IsInSsaForm()) << "Support for SSA form not implemented."; +HBasicBlock* HBasicBlock::SplitBefore(HInstruction* cursor, bool require_graph_not_in_ssa_form) { + DCHECK_IMPLIES(require_graph_not_in_ssa_form, !graph_->IsInSsaForm()) + << "Support for SSA form not implemented."; DCHECK_EQ(cursor->GetBlock(), this); HBasicBlock* new_block = @@ -2733,6 +2734,9 @@ HInstruction* HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { if (HasSIMD()) { outer_graph->SetHasSIMD(true); } + if (HasAlwaysThrowingInvokes()) { + outer_graph->SetHasAlwaysThrowingInvokes(true); + } HInstruction* return_value = nullptr; if (GetBlocks().size() == 3) { -- cgit v1.2.3-59-g8ed1b