summaryrefslogtreecommitdiff
path: root/compiler/optimizing/loop_optimization.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2019-04-29 10:55:09 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2019-04-30 11:18:14 +0100
commite07d8e69b20daa90e40c44d818dffdc41abbd50a (patch)
treea148c0ec332b76859b7bc7754be5fdbba7b31864 /compiler/optimizing/loop_optimization.cc
parent495ddc8ebf85fa973ea5743e270d62ef844b96bb (diff)
Update induction ranges in superblock cloner.
Because loop unrolling is part of a general loop optimization pass, it needs to update induction ranges as it will invalidate its instruction cache with new instructions. Bug: 131174583 Test: 696-loop (cherry picked from commit 256c94b568f35f8f23feaaf9ea0d64ed1edab1d4) Change-Id: Iba3aedbf64e7f97808b8238ec4a7ab245df5564d Merged-In: Id3628efe316b58f69abbd9ebd43e891a8e42529f
Diffstat (limited to 'compiler/optimizing/loop_optimization.cc')
-rw-r--r--compiler/optimizing/loop_optimization.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index 12b180d5ff..6c76ab858b 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -426,10 +426,12 @@ static void TryToEvaluateIfCondition(HIf* instruction, HGraph* graph) {
}
// Peel the first 'count' iterations of the loop.
-static void PeelByCount(HLoopInformation* loop_info, int count) {
+static void PeelByCount(HLoopInformation* loop_info,
+ int count,
+ InductionVarRange* induction_range) {
for (int i = 0; i < count; i++) {
// Perform peeling.
- PeelUnrollSimpleHelper helper(loop_info);
+ PeelUnrollSimpleHelper helper(loop_info, induction_range);
helper.DoPeeling();
}
}
@@ -799,7 +801,7 @@ bool HLoopOptimization::TryUnrollingForBranchPenaltyReduction(LoopAnalysisInfo*
// Perform unrolling.
HLoopInformation* loop_info = analysis_info->GetLoopInfo();
- PeelUnrollSimpleHelper helper(loop_info);
+ PeelUnrollSimpleHelper helper(loop_info, &induction_range_);
helper.DoUnrolling();
// Remove the redundant loop check after unrolling.
@@ -824,7 +826,7 @@ bool HLoopOptimization::TryPeelingForLoopInvariantExitsElimination(LoopAnalysisI
if (generate_code) {
// Perform peeling.
- PeelUnrollSimpleHelper helper(loop_info);
+ PeelUnrollSimpleHelper helper(loop_info, &induction_range_);
helper.DoPeeling();
// Statically evaluate loop check after peeling for loop invariant condition.
@@ -870,7 +872,7 @@ bool HLoopOptimization::TryFullUnrolling(LoopAnalysisInfo* analysis_info, bool g
// loop_body _/ loop_body _/
//
HLoopInformation* loop_info = analysis_info->GetLoopInfo();
- PeelByCount(loop_info, trip_count);
+ PeelByCount(loop_info, trip_count, &induction_range_);
HIf* loop_hif = loop_info->GetHeader()->GetLastInstruction()->AsIf();
int32_t constant = loop_info->Contains(*loop_hif->IfTrueSuccessor()) ? 0 : 1;
loop_hif->ReplaceInput(graph_->GetIntConstant(constant), 0u);