[PATCH] Middle-end dead code elimination

Daniel Berlin dberlin@dberlin.org
Wed Apr 16 21:10:00 GMT 2003


On Wednesday, April 16, 2003, at 04:41  PM, Diego Novillo wrote:

> On Wed, 2003-04-16 at 16:33, law@redhat.com wrote:
>
>>> This optimization centers around "expand_unreachable_stmt", a new
>>> function, which is an analog of the existing "expand_stmt".  The
>>> semantics of this function are to skip all statements up until
>>> the first label (case label or use label) where control flow can
>>> resume and only emit RTL for this and later statements.
>> What I think is going to make more sense is to run this earlier
>> in the compilation process.  Like right after we've generated the
>> trees for the function instead of at expansion time.  That way the
>> tree-ssa path can benefit by having less useless stuff to translate
>> into gimple (and eventually less rtl to generate).
>>
>> Thoughts?
>>
> Sounds interesting.  Is this something that could be easily piggybacked
> into the gimplification pass?
Possibly.
I looked at it, and it looks like with some modifications, it could be 
made to fit right in.
It might make sense to do it there, too, since we end up touching all 
the trees anyway.
You just call find_reachable_label before simplifying the various 
normal statements, and if it returns false, you replace the tree 
pointer with NULL (or whatever to remove it).
for the if stmt, it's equally easy to see how to convert 
expand_unreachable_if_stmt into replacing the then clause with a 
simplification of the then clause starting at the first reachable label 
(rather than replacing with a simplification of the then clause 
starting at the first then clause stmt), etc.


>
>
> Diego.
>



More information about the Gcc-patches mailing list