diff options
author | 2017-01-11 10:20:43 -0800 | |
---|---|---|
committer | 2017-01-13 10:04:42 -0800 | |
commit | 6b69e0acb0e4c506ce2587e362c38e36e41e34ab (patch) | |
tree | 976f08c78d3c5efa2dac8ec0409f36fae51456cb /compiler/optimizing/induction_var_range.cc | |
parent | 93939824c7e6e16cf98941cd4724278e87d6259d (diff) |
Complete unrolling of loops with small body and trip count one.
Rationale:
Avoids the unnecessary loop control overhead, suspend check,
and exposes more opportunities for constant folding in the
resulting loop body. Fully unrolls loop in execute() of
the Dhrystone benchmark (3% to 8% improvements).
Test: test-art-host
Change-Id: If30f38caea9e9f87a929df041dfb7ed1c227aba3
Diffstat (limited to 'compiler/optimizing/induction_var_range.cc')
-rw-r--r-- | compiler/optimizing/induction_var_range.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/optimizing/induction_var_range.cc b/compiler/optimizing/induction_var_range.cc index d5c4c2fa69..6d8ae75460 100644 --- a/compiler/optimizing/induction_var_range.cc +++ b/compiler/optimizing/induction_var_range.cc @@ -368,10 +368,14 @@ void InductionVarRange::Replace(HInstruction* instruction, } } -bool InductionVarRange::IsFinite(HLoopInformation* loop) const { +bool InductionVarRange::IsFinite(HLoopInformation* loop, /*out*/ int64_t* tc) const { HInductionVarAnalysis::InductionInfo *trip = induction_analysis_->LookupInfo(loop, GetLoopControl(loop)); - return trip != nullptr && !IsUnsafeTripCount(trip); + if (trip != nullptr && !IsUnsafeTripCount(trip)) { + IsConstant(trip->op_a, kExact, tc); + return true; + } + return false; } // |