This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/64700] Sink common code through PHI


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..


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