diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2019-04-29 10:55:09 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2019-04-30 09:49:17 +0000 |
commit | 256c94b568f35f8f23feaaf9ea0d64ed1edab1d4 (patch) | |
tree | 1f03dfa6f05ee6d4fc2c0a534ff8b5d5031c80cc /compiler/optimizing/loop_optimization.cc | |
parent | 7711c35fa603b86d520991c4e97ca297add81881 (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
Change-Id: Id3628efe316b58f69abbd9ebd43e891a8e42529f
Diffstat (limited to 'compiler/optimizing/loop_optimization.cc')
-rw-r--r-- | compiler/optimizing/loop_optimization.cc | 12 |
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); |