summaryrefslogtreecommitdiff
path: root/compiler/optimizing/profiling_info_builder.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-02-07 11:53:09 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2024-02-08 15:56:21 +0000
commite872656585952f993eb84633a66e0aedcbdf52ac (patch)
tree82f08a5d1dd1ca5247810b20a92c5a56a48b34a1 /compiler/optimizing/profiling_info_builder.cc
parent03ca5cf9db4110962700d47b7b5bd04592cac157 (diff)
Only compile optimized if it is useful.
If profiling doesn't benefit the method, switch a baseline compilation into optimized. Reduces the number of JIT compilations on the Sheets benchmark from ~3100 (2250 baseline, 850 optimized) to ~2750 (2250 baseline, 500 optimized). Test: test.py Change-Id: I94760481d130d2dc168152daa94429baf201f66e
Diffstat (limited to 'compiler/optimizing/profiling_info_builder.cc')
-rw-r--r--compiler/optimizing/profiling_info_builder.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/optimizing/profiling_info_builder.cc b/compiler/optimizing/profiling_info_builder.cc
index 19795f5466..f6cf676813 100644
--- a/compiler/optimizing/profiling_info_builder.cc
+++ b/compiler/optimizing/profiling_info_builder.cc
@@ -28,6 +28,7 @@
namespace art HIDDEN {
void ProfilingInfoBuilder::Run() {
+ DCHECK(GetGraph()->IsUsefulOptimizing());
DCHECK_EQ(GetGraph()->GetProfilingInfo(), nullptr);
// Order does not matter.
for (HBasicBlock* block : GetGraph()->GetReversePostOrder()) {
@@ -122,6 +123,12 @@ bool ProfilingInfoBuilder::IsInlineCacheUseful(HInvoke* invoke, CodeGenerator* c
return false;
}
}
+
+ if (!codegen->GetGraph()->IsUsefulOptimizing()) {
+ // Earlier pass knew what the calling target was. No need for an inline
+ // cache.
+ return false;
+ }
return true;
}