diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 3a6849d2b4..d321aacb08 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -2328,17 +2328,8 @@ HGraph* HGraphBuilder::CreateGraph() { graph()->MarkDeoptimizeOnUndefined(); graph()->InsertRepresentationChanges(); - if (FLAG_use_range) { - HRangeAnalysis rangeAnalysis(graph()); - rangeAnalysis.Analyze(); - } graph()->InitializeInferredTypes(); graph()->Canonicalize(); - graph()->ComputeMinusZeroChecks(); - - // Eliminate redundant stack checks on backwards branches. - HStackCheckEliminator sce(graph()); - sce.Process(); // Perform common subexpression elimination and loop-invariant code motion. if (FLAG_use_gvn) { @@ -2347,6 +2338,16 @@ HGraph* HGraphBuilder::CreateGraph() { gvn.Analyze(); } + if (FLAG_use_range) { + HRangeAnalysis rangeAnalysis(graph()); + rangeAnalysis.Analyze(); + } + graph()->ComputeMinusZeroChecks(); + + // Eliminate redundant stack checks on backwards branches. + HStackCheckEliminator sce(graph()); + sce.Process(); + // Replace the results of check instructions with the original value, if the // result is used. This is safe now, since we don't do code motion after this // point. It enables better register allocation since the value produced by