This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Question re: SSA Aggressive Dead Code Elimination


Michael Matz <matzmich@cs.tu-berlin.de> writes:

> Hi,
> 
> On Wed, 27 Jun 2001, Daniel Berlin wrote:
>>
>> If so, then even if you've not changed the DF, you've certainly
>> changed the gating path.  And changing the gating path means updating
>> the edge gating functions approriately, which you've not done.
> 
> Hmm, if I'm not mistaken, you try to solve a different problem than Jeff
> is facing.  

>You want to make the SSA (or gated SSA) valid, or at least
> match to the then existing CFG (that with only one edge to BB 2).  But the
> initial removing of that edge was wrong.  Indeed if a PHI node is
> important, then also all edges into those phi nodes are important (the
> semantic is to select between different thing, and removing edges means to
> remove possibilities to select from, which in this case, because it isn't
> provable, that all of these cases are the same).  I think, this is the
> cleanest approach instead of adding helper insns to not create empty BB's
> and having the possibility to mark them important.

The initial removing of the edge isn't strictly wrong, as long as you
update the phi nodes accordingly.  Obviously, just removing the edge
without without updating the phi nodes *is* wrong.
If the phi node was updated, you'd see that it's not necessary
anymore, and remove it, or, at worst, see that we need to be selecting
a different edge now, since the CFG has changed.
It's a trade off.
You either have to update the phi nodes, which may involve recomputing
a bunch of info, or you have to not touch the edges that may break
the phi nodes.

> 
> In fact in the presence of SSA it is not correct to remove edges just
> because the target block doesn't contain any important insns, exactly
> because CFG information is coded into the insn stream (the phi nodes), so
> the non-importance of insns is not at all obvious.

Right.
In no case can you just remove edges. You either have to update the
phi nodes approriately, or not remove the edges.

*or*, you can not have edges in phi nodes, which would also solve the
problem, but require a lot more reworking (since we currently *do* use
the edge pointers when converting out of SSA, in order to avoid
inserting useless copies and whatnot), and lessen the ability of us to
optimize the code.
In practice, we'd rather have gated SSA than normal SSA. We can do
more with it. 
But it means a higher level of complexity in our optimizations.


> 
> 
> Ciao,
> Michael.

-- 
"I have the oldest typewriter in the world.  It types in pencil.
"-Steven Wright


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]