summaryrefslogtreecommitdiff
path: root/compiler/optimizing/superblock_cloner.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/superblock_cloner.cc')
-rw-r--r--compiler/optimizing/superblock_cloner.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/compiler/optimizing/superblock_cloner.cc b/compiler/optimizing/superblock_cloner.cc
index 878967cc6e..dc433feb51 100644
--- a/compiler/optimizing/superblock_cloner.cc
+++ b/compiler/optimizing/superblock_cloner.cc
@@ -17,6 +17,7 @@
#include "superblock_cloner.h"
#include "common_dominator.h"
+#include "induction_var_range.h"
#include "graph_checker.h"
#include <iostream>
@@ -556,6 +557,13 @@ bool SuperblockCloner::CollectLiveOutsAndCheckClonable(HInstructionMap* live_out
return true;
}
+void SuperblockCloner::UpdateInductionRangeInfoOf(
+ HInstruction* user, HInstruction* old_instruction, HInstruction* replacement) {
+ if (induction_range_ != nullptr) {
+ induction_range_->Replace(user, old_instruction, replacement);
+ }
+}
+
void SuperblockCloner::ConstructSubgraphClosedSSA() {
if (live_outs_.empty()) {
return;
@@ -599,6 +607,7 @@ void SuperblockCloner::ConstructSubgraphClosedSSA() {
++it;
if (!IsInOrigBBSet(user->GetBlock())) {
user->ReplaceInput(phi, index);
+ UpdateInductionRangeInfoOf(user, value, phi);
}
}
@@ -776,7 +785,8 @@ void SuperblockCloner::DumpInputSets() {
SuperblockCloner::SuperblockCloner(HGraph* graph,
const HBasicBlockSet* orig_bb_set,
HBasicBlockMap* bb_map,
- HInstructionMap* hir_map)
+ HInstructionMap* hir_map,
+ InductionVarRange* induction_range)
: graph_(graph),
arena_(graph->GetAllocator()),
orig_bb_set_(arena_, orig_bb_set->GetSizeOf(), true, kArenaAllocSuperblockCloner),
@@ -785,6 +795,7 @@ SuperblockCloner::SuperblockCloner(HGraph* graph,
remap_incoming_(nullptr),
bb_map_(bb_map),
hir_map_(hir_map),
+ induction_range_(induction_range),
outer_loop_(nullptr),
outer_loop_bb_set_(arena_, orig_bb_set->GetSizeOf(), true, kArenaAllocSuperblockCloner),
live_outs_(std::less<HInstruction*>(),
@@ -1078,7 +1089,8 @@ HLoopInformation* FindCommonLoop(HLoopInformation* loop1, HLoopInformation* loop
}
bool PeelUnrollHelper::IsLoopClonable(HLoopInformation* loop_info) {
- PeelUnrollHelper helper(loop_info, nullptr, nullptr);
+ PeelUnrollHelper helper(
+ loop_info, /* bb_map= */ nullptr, /* hir_map= */ nullptr, /* induction_range= */ nullptr);
return helper.IsLoopClonable();
}
@@ -1119,12 +1131,13 @@ HBasicBlock* PeelUnrollHelper::DoPeelUnrollImpl(bool to_unroll) {
return loop_header;
}
-PeelUnrollSimpleHelper::PeelUnrollSimpleHelper(HLoopInformation* info)
+PeelUnrollSimpleHelper::PeelUnrollSimpleHelper(HLoopInformation* info,
+ InductionVarRange* induction_range)
: bb_map_(std::less<HBasicBlock*>(),
info->GetHeader()->GetGraph()->GetAllocator()->Adapter(kArenaAllocSuperblockCloner)),
hir_map_(std::less<HInstruction*>(),
info->GetHeader()->GetGraph()->GetAllocator()->Adapter(kArenaAllocSuperblockCloner)),
- helper_(info, &bb_map_, &hir_map_) {}
+ helper_(info, &bb_map_, &hir_map_, induction_range) {}
} // namespace art