Reviewers: Jakob,

Description:
Remove dead constants not in block #0.

BUG=

Please review this at https://codereview.chromium.org/27473004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -4 lines):
  M src/hydrogen-dce.cc


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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to