Revision: 8997
Author:   [email protected]
Date:     Tue Aug 23 04:19:08 2011
Log:      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
http://code.google.com/p/v8/source/detail?r=8997

Modified:
 /branches/bleeding_edge/src/hydrogen.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Aug 23 00:34:45 2011
+++ /branches/bleeding_edge/src/hydrogen.cc     Tue Aug 23 04:19:08 2011
@@ -2328,17 +2328,8 @@
   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 @@
     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

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to