This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] DCE and conditionals
- From: law at redhat dot com
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>, Diego Novillo <dnovillo at redhat dot com>
- Date: Mon, 05 May 2003 16:30:03 -0600
- Subject: Re: [tree-ssa] DCE and conditionals
- Reply-to: law at redhat dot com
In message <1052137908.19625.1223.camel@p4>, Andrew MacLeod writes:
>That means we want someone, perhaps a very fast little pass of its own
>that we can call when we want it, that goes into PHI nodes, looks at
>them, and decides when they can be replaced with a copy.
Yes, this can be done very quickly. It looks something like this:
FOR_EACH_BB (bb)
FOR_EACH_PHI (phi)
FOR_EACH_PHI_ARG (phi_arg)
if (phi_arg == phi_result)
continue;
if (phi_arg == seen_arg)
continue;
if (seen_arg == NULL)
seen_arg = arg
else
FAIL
if (!FAIL)
remove phi & insert copy at start of basic block
The only trick is dealing with dependencies between arguments/results
of PHI nodes.
Jeff