Do not produce empty try-finally statements
Tue Jan 28 14:10:00 GMT 2014
On Tue, 28 Jan 2014, Jakub Jelinek wrote:
> On Tue, Jan 28, 2014 at 01:48:21PM +0100, Michael Matz wrote:
> > Hi,
> > On Tue, 28 Jan 2014, Jakub Jelinek wrote:
> > > There are two kinds of clobbers, the direct ones, which surely can be
> > > safely removed by ehcleanup1 if they are the only reason why there is a
> > > landing pad which will be rethrown outside of the current function,
> > You can only safely (as in, not introducing false conflicts for stack
> > slots) remove them before inlining, _if_ the inliner would add them back
> > in ...
> So it is just an optimization thing, not correctness, right?
Of course, it always was. It's "safe" to remove all clobbers always. But
then it's also pointless to generate them. For them to make sense they
must survive until expansion.
> We've been doing it this way since 4.7.0.
> > > For the direct cleanups, the important thing is that they are necessarily
> > > local variables in the current function, so when returning from that
> > > function, whether normally or abnormally, the inliner still has all the info
> > > about them. If it wants, it can add the corresponding clobbers itself
> > ... which it doesn't.
> So, if we want to improve it, we should do that in the inliner.
That'd we ideal, yes.
> Because, not removing them in the ehcleanup1 means the inliner will see far
> more complex functions than really necessary.
I'll dispute the "far", but yeah.
More information about the Gcc-patches