This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64700] Sink common code through PHI
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 21 Jan 2015 20:42:18 +0000
- Subject: [Bug tree-optimization/64700] Sink common code through PHI
- Auto-submitted: auto-generated
- References: <bug-64700-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64700
--- Comment #2 from Jeffrey A. Law <law at redhat dot com> ---
I had a code hoisting pass on top of PRE a while back as well. Can't remember
why I abandoned it. Oh yea, on top of PRE :-)
I've still got a global code motion pass here based on Click's work. It
handles both hoisting and sinking. Basically you record the earliest possible
block for each statement and a latest block for each statement. The path
through the dominator tree connecting those two blocks is the set of valid
blocks for the statement.
Then you just choose the 'best' one in that path. Most control dependent path
within the shallowest loop nest.
It didn't handle sinking PHIs or hoisting/sinking through a dependent node.
Not sure if it could be changed to do that.
I never pushed on it simply because it never did significantly better than the
other code motion code we already have. It pointed out a few minor issues in
tree-ssa-sink.c, but nothing that couldn't be easily fixed.
Too bad, I always found the basic algorithm to be rather elegant.
I'm certain we're missing all kinds of interesting code motions..