|
|
> On Sun, 29 Mar 2009, Jan Hubicka wrote:
>
> > Hi,
> > this patch implements EH cleanup pass doing:
> > 1) cleanups regions with handlers doing nothing are optimized out
> > 2) MUST_NOT_THROW regions that became dead because of 1) are optimized out
> > 3) Info about regions that are containing instructions, and regions
> > reachable via local EH edges is collected
> > 4) Eh tree is pruned for regions no longer neccesary.
> > It differs from pretty-ipa that has cleanup region elimination in
> > tree-cfgcleanup.
> > With improved NOTHROW detection I no longer see that many abnormal PHIs
> > preventing
> > optimization during early stages so I don't see that much value in re-donig
> > the optimization all the time.
> >
> > There are more optimization oppurtunities here. In particular we can unify
> > all
> > MUST_NOT_THROW regions that contains no local resumes and move all
> > MUST_NOT_THROW to the root of the tree to save some dwarf space. We can
> > also
> > decide whether we can unify all terminate() calls in the function. This
> > kills
> > unwind info on terminate so I am not sure we want to do it at -O2, but
> > probably
> > we ought at -Os. Main problem of those local must not throws is that they
> > confuse inliner while they rarely survive to end of compilation. I will
> > teach
> > inliner to cowardly ignore their existence. This I plan to all handle
> > later to
> > avoid snowballing. Half of EH regions from tramp3d should go away this way
> > and we can look into unifying equivalent sibling EH regions that seems to
> > have good
> > chances of success.
> >
> > I do the ehcleanup 3 times now, once at the end of early optimization queue.
> > This is most effective pass important to get right inline size estimates and
> > reduce LTO throughput. Then just after IPA passes. It is not that
> > effective
> > on tramp but wiht IPA propagain and fixing inlining decisions in general we
> > ought to be able to eliminate a lot of unreachable regions. Finally it is
> > done
> > at before going to RTL. Dead code elimination might render more cleanups
> > useless.
> >
> > The scores on tramp3d are following:
> >
> > 1106 empty EH cleanups are eliminated in ehcleanup1, 4 in ehcleanup3
> > same numbers of MUST_NOT_THROW regions are removed
> > 6298 unreachable EH regions are eliminated in ehcleanup1, 23 in ehcleanup2,
> > 4 in ehcleanup3
>
> Sooo .. the numbers suggest pretty clearly to me that we should for now
> stick with only ehcleanup1. Given our inability to remove dead passes
> later ;)
Well, tramp3d is not the most sophificated testcase around in this
respect. It all works so well largely because tramp's callgraph is
acyclic and there is little work left to real inliner. Not doing so
would leave us with emitting completely stupid emtpy cleanups as we do
now. I need to find some testcase with interesting non-trivial EH for
better stats.
But I would be happy with just one pass for now and we can do more
evaulation later. Both A-I and LTO are going to affect this.
A-I is going to make early ellimination better, LTO is going to make
ehcleanup2 more informed.
And I hope I can kill RTL's unreachable EH blocks removal soon.
Honza
|
|