This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question re: SSA Aggressive Dead Code Elimination
- To: <law at redhat dot com>
- Subject: Re: Question re: SSA Aggressive Dead Code Elimination
- From: Daniel Berlin <dan at www dot cgsoftware dot com>
- Date: Wed, 27 Jun 2001 13:15:34 -0400 (EDT)
- cc: <gcc at gcc dot gnu dot org>
> Again, I think you're missing the point. Go back to the RTL I posted and
> consider that behavior of the jump insn is dependent on the inputs to the
> registers I mentioned had live values at entry.
Then it should be marked as important, and not turned unconditional. And
every other implementation of
Morgan's DCE i see does this by following the phi node definitions.
If you are saying that morgan's book doesn't say to do this, it's wrong.
However, those that are using Morgan's DCE do mark the phi node control
dependences properly, so either they are using a different one of
morgan's dce algorithms (I don't have his book), or something.
For example:
/* Process_worklist() -- Middle phase of Morgan's algorithm.
* For each worklist entry, follow control and data dependences
* of a known-necessary operation and add any newly-discovered
* necessities to the worklist.
*/
void
Dcessa::process_worklist()
{
while (!worklist.empty()) {
Operation operation = worklist.front();
worklist.pop_front();
// Follow control dependences: mark as necessary the CTIs of each
// block on which operation depends. Since a phi-node operation
// represents copies at the end of each of the predecessors of the
// block to which it's attached, follow dependences from those
// predecessors in the phi-node case.
if (operation.is_phi_node()) {
CfgNode *block = ssa_form->phi_node_block(operation.get_phi_node());
for (CfgNodeHandle pit = preds_start(block);
pit != preds_end(block); ++pit)
mark_controlling_ctis(*pit);
} else {
CfgNode *block = get_parent_node(*operation.get_instr_handle());
mark_controlling_ctis(block);
}
...
I can tell you that those that appear to implement morgan's algorithm
(once again, i don't have his book, so i can't tell you if it's the same
algorithm, without seeing *your* code), handle it like the above. I.E.
marking the control dependences inside a phi node.
--Dan