Closed Bug 669796 Opened 10 years ago Closed 7 years ago

IonMonkey: perform unreachable code elimination during GVN


(Core :: JavaScript Engine, defect)

Not set





(Reporter: rpearl, Assigned: rpearl)


(Blocks 1 open bug)


(Whiteboard: [ion:t])

Follow up to Bug 659729.

I think it's probably natural to perform unreachable code elimination during the GVN pass--I'll see if I can make this work.
Could you summarize your design/algorithm idea here?
Sorry, this dropped out of sight. The algorithm would be something like:

Assume that the start block is reachable. Assume that all other blocks and edges are unreachable.

Examine control flow instructions during GVN: If an outgoing edge can be followed, mark it reachable. Once an edge becomes reachable, the target blocks of that edge become reachable. 
Inputs of phi nodes from unreachable edges are ignored.
Is this still needed?
Bug 620767 provides a similar optimization, though it is not integrated with GVN.
Sorry for the spam! I cannot type, apparently. Bug 820676!
Duplicate of this bug: 839217
One advantage to doing the integration proposed in this bug would be better handling of code like the following:

    if (foo() && false) { ... }

In this case we currently fail to optimize away the body.  This is because the |foo() && false| is first stored into a variable, and at the time the pass runs the constants have not been fully propagated.  This situation arises in self-hosted code for ParallelArray, where inlined functions are often evaluated to true or false to select different control flow in sequential or parallel mode.
The new GVN implementation (bug 1004363) is capable of this. Bug 1029830 tracks enabling it.
Closed: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1029830
You need to log in before you can comment on or make changes to this bug.