From 24a7e06323048049bffadb74e4967c13bda9e829 Mon Sep 17 00:00:00 2001 From: "titzer@chromium.org" Date: Wed, 16 Oct 2013 13:19:46 +0000 Subject: [PATCH] Remove dead constants not in block #0. BUG= R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/27473004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17240 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-dce.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hydrogen-dce.cc b/src/hydrogen-dce.cc index cba9e42b67..3b64107fa1 100644 --- a/src/hydrogen-dce.cc +++ b/src/hydrogen-dce.cc @@ -97,10 +97,12 @@ void HDeadCodeEliminationPhase::RemoveDeadInstructions() { for (HInstructionIterator it(block); !it.Done(); it.Advance()) { HInstruction* instr = it.Current(); if (!instr->CheckFlag(HValue::kIsLive)) { - // Instruction has not been marked live; assume it is dead and remove. - // TODO(titzer): we don't remove constants because some special ones - // might be used by later phases and are assumed to be in the graph - if (!instr->IsConstant()) instr->DeleteAndReplaceWith(NULL); + // Instruction has not been marked live, so remove it. + if (!instr->IsConstant() || instr->block()->block_id() != 0) { + // TODO(titzer): Some global constants in block 0 can be used + // again later, and can't currently be removed. Fix that. + instr->DeleteAndReplaceWith(NULL); + } } else { // Clear the liveness flag to leave the graph clean for the next DCE. instr->ClearFlag(HValue::kIsLive);