diff options
author | 2022-11-10 10:26:31 +0000 | |
---|---|---|
committer | 2022-11-23 10:44:45 +0000 | |
commit | b2d364d0eee1d6df4b49e3a7d5b3c4c11af3b3ca (patch) | |
tree | 710badc4b3252213bd2d19f0fcca09f20ba01e2a /compiler/optimizing/nodes.cc | |
parent | 316fe63e68a83db41540650101e0597b36853529 (diff) |
Remove tries which don't contain throwing instructions
If nothing can throw within a TryBoundary, we are safe to eliminate
it. We were already doing this at the builder stage, but this CL
takes care of subsequent passes (e.g. we might remove DivZeroCheck
instructions which means that now we know we can't throw).
Sometimes this means we are able to eliminate catch blocks which
brings some code size improvements.
Locally on a Pixel 5 compiling with `speed`:
* AGSA -684K (0.2%)
* services.jar -100K (0.2%)
* SystemUIGoogle -88K (0.3%)
Bug: 229249867
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I36d5880be99c1f1109c94266b1be583de8d6cf72
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r-- | compiler/optimizing/nodes.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index d40ce7a717..841576a5e5 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -2885,7 +2885,10 @@ HInstruction* HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { // At this point we might either have: // A) Return/ReturnVoid/Throw as the last instruction // B) `Return/ReturnVoid->TryBoundary->Goto` as the last instruction chain - // C) `Throw->TryBoundary` as the last instruction chain + // C) `Return/ReturnVoid->Goto` as the last instruction chain. This exists when we added the + // extra Goto because we had a TryBoundary which we could eliminate in DCE after + // substituting arguments. + // D) `Throw->TryBoundary` as the last instruction chain const bool saw_goto = last->IsGoto(); if (saw_goto) { @@ -2903,7 +2906,6 @@ HInstruction* HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { } // Check that if we have an instruction chain, it is one of the allowed ones. - DCHECK_IMPLIES(saw_goto, saw_try_boundary); DCHECK_IMPLIES(saw_goto, last->IsReturnVoid() || last->IsReturn()); if (last->IsThrow()) { |