Please Clang wrt stack frames in HInliner::TryBuildAndInlineHelper.
This change enables Clang to compile ART on MIPS64 without
complaining about stack frames larger than what
`-Wframe-larger-than` allows.
Change-Id: I72f424922d9cb3d01f7b8ba4e5cb9170b82870d9
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 7068e8b..33803c1 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1061,14 +1061,19 @@
caller_instruction_counter);
callee_graph->SetArtMethod(resolved_method);
- OptimizingCompilerStats inline_stats;
+ // When they are needed, allocate `inline_stats` on the heap instead
+ // of on the stack, as Clang might produce a stack frame too large
+ // for this function, that would not fit the requirements of the
+ // `-Wframe-larger-than` option.
+ std::unique_ptr<OptimizingCompilerStats> inline_stats =
+ (stats_ == nullptr) ? nullptr : MakeUnique<OptimizingCompilerStats>();
HGraphBuilder builder(callee_graph,
&dex_compilation_unit,
&outer_compilation_unit_,
resolved_method->GetDexFile(),
*code_item,
compiler_driver_,
- &inline_stats,
+ inline_stats.get(),
resolved_method->GetQuickenedInfo(),
dex_cache,
handles_);