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
This commit is contained in:
titzer@chromium.org 2013-10-16 13:19:46 +00:00
parent 6054baadd2
commit 24a7e06323

View File

@ -97,10 +97,12 @@ void HDeadCodeEliminationPhase::RemoveDeadInstructions() {
for (HInstructionIterator it(block); !it.Done(); it.Advance()) { for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current(); HInstruction* instr = it.Current();
if (!instr->CheckFlag(HValue::kIsLive)) { if (!instr->CheckFlag(HValue::kIsLive)) {
// Instruction has not been marked live; assume it is dead and remove. // Instruction has not been marked live, so remove it.
// TODO(titzer): we don't remove constants because some special ones if (!instr->IsConstant() || instr->block()->block_id() != 0) {
// might be used by later phases and are assumed to be in the graph // TODO(titzer): Some global constants in block 0 can be used
if (!instr->IsConstant()) instr->DeleteAndReplaceWith(NULL); // again later, and can't currently be removed. Fix that.
instr->DeleteAndReplaceWith(NULL);
}
} else { } else {
// Clear the liveness flag to leave the graph clean for the next DCE. // Clear the liveness flag to leave the graph clean for the next DCE.
instr->ClearFlag(HValue::kIsLive); instr->ClearFlag(HValue::kIsLive);