This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Middle-end dead code elimination


On Sat, 29 Mar 2003, S. Bosscher wrote:
> > The following patch implements limited syntax-directed dead code
> > elimination in GCC's middle-end.  The theory is that now that we
> > have function-at-time compilation its possible for GCC's expanders
> > to avoid generating RTL that it knows is unreachable.
>
> No please.  First of all, like you said, this work will be
> superceded by the tree-ssa work.                   ^^^^

I believe that the most I claimed was that this work *may* be
superseded by tree-ssa for *optimizing* compilation when (if
ever) the tree-ssa branches reaches acceptable compile time
and code quality performance to be integrated into mainline.

Unfortunately, my crystal ball is down at the moment, or I'd
have addressed your concerns before you raised them :>


> Second, unless I'm missing something you may be breaking a few
> cases of -Wunreachable-code.  That warning happens to be broken
> already (PR 10175) so it is not possible right now to see the
> effects of your patch on it.

I don't suppose you've considered the fact that the new function
expand_unreachable_stmt would be the perfect place to fix PR 10175?
The dynamic nature of toplev.c means that on 3.3 and 3.4, the
"unreachable code" in the example given in that PR is eliminated
by cleanup_cfg long before CSE.  Of course, the -Wunreachable-code
was always broken in non-optimizing compilations where CSE/jump
wasn't run!

The perfect fix to these problems would be to issue the warning on
enountering the first ignored statement in expand_unreachable_stmt.
If my patch gets approved, I'll submit a follow-up patch to do
just that.

The closer the warning is to the front-end and user-level code,
the less likely it is to generate warnings from non-obvious code
transformations such as jump bypassing or template instantiation,
where it might be not clear in source code form why the code is
never executed.

Roger
--


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