Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index a4ab7b5c1723910ca98bbe62cca5b18f3be4d4ce..5a9ff9d56fcb8551141824feac03575d22fb596d 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -307,7 +307,9 @@ static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function, |
} |
BlockScheduler block_scheduler(flow_graph); |
- if (optimized && FLAG_reorder_basic_blocks) { |
+ const bool reorder_blocks = |
+ FlowGraph::ShouldReorderBlocks(function, optimized); |
+ if (reorder_blocks) { |
block_scheduler.AssignEdgeWeights(); |
} |
@@ -508,7 +510,7 @@ static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function, |
// Perform register allocation on the SSA graph. |
FlowGraphAllocator allocator(*flow_graph); |
allocator.AllocateRegisters(); |
- if (FLAG_reorder_basic_blocks) block_scheduler.ReorderBlocks(); |
+ if (reorder_blocks) block_scheduler.ReorderBlocks(); |
if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { |
FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); |