diff options
author | 2017-08-04 13:21:31 -0700 | |
---|---|---|
committer | 2017-08-09 13:30:21 -0700 | |
commit | 179861c7e8bb4f5f1b44e7588fc8791446c30ae5 (patch) | |
tree | b4310dc30bfb5f161af6e8bcee8b8a39baa449ad /compiler/optimizing/scheduler.cc | |
parent | 3b21019edb5586a73516833482fc203e75309dbe (diff) |
Run HeapLocationCollector once in scheduler instead of locally.
HeapLocationCollector does alias analysis globally instead of at block
scale. For example doing it locally breaks the pre-existence based alias
analysis. It's also expensive to do it for each basic block.
Test: run-test/gtest on target/host, 662-regression-alias
Bug: 64018485
Change-Id: If001e2961b5a52b50b1bcefd5e4a89d9c25f25b8
Diffstat (limited to 'compiler/optimizing/scheduler.cc')
-rw-r--r-- | compiler/optimizing/scheduler.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/optimizing/scheduler.cc b/compiler/optimizing/scheduler.cc index 5ad011d8f9..3e373d16fb 100644 --- a/compiler/optimizing/scheduler.cc +++ b/compiler/optimizing/scheduler.cc @@ -554,6 +554,14 @@ SchedulingNode* CriticalPathSchedulingNodeSelector::GetHigherPrioritySchedulingN } void HScheduler::Schedule(HGraph* graph) { + // We run lsa here instead of in a separate pass to better control whether we + // should run the analysis or not. + LoadStoreAnalysis lsa(graph); + if (!only_optimize_loop_blocks_ || graph->HasLoops()) { + lsa.Run(); + scheduling_graph_.SetHeapLocationCollector(lsa.GetHeapLocationCollector()); + } + for (HBasicBlock* block : graph->GetReversePostOrder()) { if (IsSchedulable(block)) { Schedule(block); @@ -566,14 +574,6 @@ void HScheduler::Schedule(HBasicBlock* block) { // Build the scheduling graph. scheduling_graph_.Clear(); - - // Only perform LSA/HeapLocation analysis on the basic block that - // is going to get instruction scheduled. - HeapLocationCollector heap_location_collector(block->GetGraph()); - heap_location_collector.VisitBasicBlock(block); - heap_location_collector.BuildAliasingMatrix(); - scheduling_graph_.SetHeapLocationCollector(heap_location_collector); - for (HBackwardInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { HInstruction* instruction = it.Current(); CHECK_EQ(instruction->GetBlock(), block) |