summaryrefslogtreecommitdiff
path: root/compiler/optimizing/inliner.cc
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2017-11-21 16:31:53 -0800
committer Aart Bik <ajcbik@google.com> 2017-11-24 17:06:40 -0800
commitf0010dd946b17490d2f792d845ea4f304a0bea28 (patch)
treee68b071ef742766090d722129c8c1d04ba2f90b0 /compiler/optimizing/inliner.cc
parent6f99acac2e1d60dfb1ed45ce69ec5a542847687e (diff)
Apply individual intrinsic recognition during inliner.
Rationale: Inliner could introduce new method calls, in particular it could change invoke-interface to invoke-virtual, which could expose new intrinsics. This situation happens, for example, in Kotlin generated code where String operations first go through the CharSequence interface. Rather than running a full new phase, we just recognize intrinsics when interface calls are replaced by virtual calls. This optimization boosts KotlinMicroItems by 100% Test: test-art-host test-art-target Change-Id: Ibd0519283d67ed6997b056e34b4eafdd49fcbc2d
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r--compiler/optimizing/inliner.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 3f4a3d8b8e..1eb1f2e46b 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1258,6 +1258,13 @@ bool HInliner::TryInlineAndReplace(HInvoke* invoke_instruction,
new_invoke->SetReferenceTypeInfo(invoke_instruction->GetReferenceTypeInfo());
}
return_replacement = new_invoke;
+ // Directly check if the new virtual can be recognized as an intrinsic.
+ // This way, we avoid running a full recognition pass just to detect
+ // these relative rare cases.
+ bool wrong_invoke_type = false;
+ if (IntrinsicsRecognizer::Recognize(new_invoke, &wrong_invoke_type)) {
+ MaybeRecordStat(stats_, kIntrinsicRecognized);
+ }
} else {
// TODO: Consider sharpening an invoke virtual once it is not dependent on the
// compiler driver.