Revision: 6721
Author: [email protected]
Date: Thu Feb 10 02:28:59 2011
Log: Fix a representation change bug in the Hydrogen graph construction.

We could try to treat an HPhi as an HInstruction because the code did
not properly handle the case of a phi in a block with itself as one of
the predecessors.

BUG=v8:1134

Review URL: http://codereview.chromium.org/6471020
http://code.google.com/p/v8/source/detail?r=6721

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

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Thu Feb 10 01:16:33 2011
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Feb 10 02:28:59 2011
@@ -1813,16 +1813,14 @@
                                               bool is_truncating) {
   // Insert the representation change right before its use. For phi-uses we
   // insert at the end of the corresponding predecessor.
-  HBasicBlock* insert_block = use->block();
+  HInstruction* next = NULL;
   if (use->IsPhi()) {
     int index = 0;
     while (use->OperandAt(index) != value) ++index;
-    insert_block = insert_block->predecessors()->at(index);
-  }
-
-  HInstruction* next = (insert_block == use->block())
-      ? HInstruction::cast(use)
-      : insert_block->end();
+    next = use->block()->predecessors()->at(index)->end();
+  } else {
+    next = HInstruction::cast(use);
+  }

   // For constants we try to make the representation change at compile
   // time. When a representation change is not possible without loss of

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

Reply via email to