From e872656585952f993eb84633a66e0aedcbdf52ac Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 7 Feb 2024 11:53:09 +0000 Subject: 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 --- compiler/optimizing/profiling_info_builder.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/optimizing/profiling_info_builder.cc') 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; } -- cgit v1.2.3-59-g8ed1b