Revision: 19779
Author:   [email protected]
Date:     Tue Mar 11 08:14:38 2014 UTC
Log:      Really skip dead blocks in GVN

[email protected]

Review URL: https://codereview.chromium.org/194413002
http://code.google.com/p/v8/source/detail?r=19779

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-gvn.cc Fri Mar  7 10:14:03 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-gvn.cc Tue Mar 11 08:14:38 2014 UTC
@@ -592,7 +592,9 @@
               graph()->use_optimistic_licm() ? "yes" : "no");
   for (int i = graph()->blocks()->length() - 1; i >= 0; --i) {
     HBasicBlock* block = graph()->blocks()->at(i);
-    if (block->IsLoopHeader()) {
+    if (block->IsLoopHeader() &&
+        block->IsReachable() &&
+        !block->IsDeoptimizing()) {
       SideEffects side_effects = loop_side_effects_[block->block_id()];
       if (FLAG_trace_gvn) {
         HeapStringAllocator allocator;
@@ -616,6 +618,7 @@
     HBasicBlock* block,
     HBasicBlock* loop_header,
     SideEffects loop_kills) {
+  if (!block->IsReachable() || block->IsDeoptimizing()) return;
   HBasicBlock* pre_header = loop_header->predecessors()->at(0);
   if (FLAG_trace_gvn) {
     HeapStringAllocator allocator;
@@ -680,10 +683,8 @@

 bool HGlobalValueNumberingPhase::ShouldMove(HInstruction* instr,
                                             HBasicBlock* loop_header) {
-  // If we've disabled code motion or we're in a block that unconditionally
-  // deoptimizes, don't move any instructions.
-  return AllowCodeMotion() && !instr->block()->IsDeoptimizing() &&
-      instr->block()->IsReachable();
+  // If we've disabled code motion, don't move any instructions.
+  return AllowCodeMotion();
 }


@@ -776,20 +777,18 @@
   }

   GvnBasicBlockState* next_dominated(Zone* zone) {
-    dominated_index_++;
-    if (dominated_index_ == length_ - 1) {
-      // No need to copy the map for the last child in the dominator tree.
-      Initialize(block_->dominated_blocks()->at(dominated_index_),
-                 map(),
-                 dominators(),
-                 false,
-                 zone);
-      return this;
-    } else if (dominated_index_ < length_) {
-      return push(zone, block_->dominated_blocks()->at(dominated_index_));
-    } else {
-      return NULL;
+    while (++dominated_index_ < length_) {
+ HBasicBlock* block = block_->dominated_blocks()->at(dominated_index_);
+      if (block->IsReachable()) {
+        if (dominated_index_ == length_ - 1) {
+ // No need to copy the map for the last child in the dominator tree.
+          Initialize(block, map(), dominators(), false, zone);
+          return this;
+        }
+        return push(zone, block);
+      }
     }
+    return NULL;
   }

   GvnBasicBlockState* push(Zone* zone, HBasicBlock* block) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to