From c0fd053982ae0c932a4736f7e558f849f764ab02 Mon Sep 17 00:00:00 2001 From: "kmillikin@chromium.org" Date: Thu, 10 Feb 2011 10:28:59 +0000 Subject: [PATCH] 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 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6721 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 7917ef4..2c65eea 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1813,17 +1813,15 @@ void HGraph::InsertRepresentationChangeForUse(HValue* value, 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); + next = use->block()->predecessors()->at(index)->end(); + } else { + next = HInstruction::cast(use); } - HInstruction* next = (insert_block == use->block()) - ? HInstruction::cast(use) - : insert_block->end(); - // For constants we try to make the representation change at compile // time. When a representation change is not possible without loss of // information we treat constants like normal instructions and insert the -- 2.7.4