From: fschneider@chromium.org Date: Tue, 23 Aug 2011 11:19:08 +0000 (+0000) Subject: Perform range analysis after GVN. X-Git-Tag: upstream/4.7.83~18665 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=701146a3d72589594291f0a5be2bba39d058c0b6;p=platform%2Fupstream%2Fv8.git Perform range analysis after GVN. This eliminate redundant HChange instructions and allows range information of converted values propagated across control-flow splits. It fixes the performance regression on code like: if (x > 1) { y = x - 1; } where we should eliminate the overflow check on the sub inside the if-statement. Review URL: http://codereview.chromium.org/7709025 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8997 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 3a6849d2b..d321aacb0 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