Index: src/hydrogen-dce.cc |
diff --git a/src/hydrogen-dce.cc b/src/hydrogen-dce.cc |
index cba9e42b67a560f11e65ecc092ac73cdd07534df..3b64107fa119fe1c0245bd33313b80c1809c33d4 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); |