Fix inliner instruction/register limits
Because instruction/register usage was compared with >=, the limits
were actually one lower than the constants. This prevented trivial
getters/setters from being inlined because they were 3 SSA
instructions.
Test: build + boot + presubmit
Bug: 185143864
Change-Id: Ie27c9163efe79bb7392c881c0165ab1164323a2c
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 3e9969d..1ba1c6c 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1862,7 +1862,7 @@
for (HInstructionIterator instr_it(block->GetInstructions());
!instr_it.Done();
instr_it.Advance()) {
- if (++number_of_instructions >= inlining_budget_) {
+ if (++number_of_instructions > inlining_budget_) {
LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedInstructionBudget)
<< "Method " << resolved_method->PrettyMethod()
<< " is not inlined because the outer method has reached"
@@ -1871,7 +1871,7 @@
}
HInstruction* current = instr_it.Current();
if (current->NeedsEnvironment() &&
- (total_number_of_dex_registers_ >= kMaximumNumberOfCumulatedDexRegisters)) {
+ (total_number_of_dex_registers_ > kMaximumNumberOfCumulatedDexRegisters)) {
LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedEnvironmentBudget)
<< "Method " << resolved_method->PrettyMethod()
<< " is not inlined because its caller has reached"
@@ -2057,7 +2057,7 @@
// Bail early for pathological cases on the environment (for example recursive calls,
// or too large environment).
- if (total_number_of_dex_registers_ >= kMaximumNumberOfCumulatedDexRegisters) {
+ if (total_number_of_dex_registers_ > kMaximumNumberOfCumulatedDexRegisters) {
LOG_NOTE() << "Calls in " << callee_graph->GetArtMethod()->PrettyMethod()
<< " will not be inlined because the outer method has reached"
<< " its environment budget limit.";