From a8b8e9b12a9740d71cff2fa65d47825b74f72c37 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Tue, 9 Jan 2018 11:01:02 -0800 Subject: Improve code sinking near "always throwing" method calls Rationale: With simple dex bytecode analysis, the inliner marks methods that always throw to help subsequent code sinking. This reduces overhead of non-nullable enforcing calls found in e.g the Kotlin runtime library (1%-2% improvement on tree microbenchmark, about 5% on Denis' benchmark). Test: test-art-host test-art-target Change-Id: I45348f049721476828eb5443738021720d2857c0 --- compiler/optimizing/code_sinking.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/code_sinking.cc') diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index d8ebac95a8..f4760d661f 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -34,7 +34,9 @@ void CodeSinking::Run() { // TODO(ngeoffray): we do not profile branches yet, so use throw instructions // as an indicator of an uncommon branch. for (HBasicBlock* exit_predecessor : exit->GetPredecessors()) { - if (exit_predecessor->GetLastInstruction()->IsThrow()) { + HInstruction* last = exit_predecessor->GetLastInstruction(); + // Any predecessor of the exit that does not return, throws an exception. + if (!last->IsReturn() && !last->IsReturnVoid()) { SinkCodeToUncommonBranch(exit_predecessor); } } -- cgit v1.2.3-59-g8ed1b