[PATCH] PRE: hoist operations into common dominator when possible.

Daniel Berlin dberlin at dberlin.org
Fri Aug 15 13:22:41 PDT 2014


This looks fine to me, though note that PRE would not normally do this
because it's not "lifetime optimal" (since it extends the lifetime of the
multiply), which is PRE's goal.  Doing what you are doing can at least
theoretically be a lose for performance in some cases due to increasing
register pressure.

I'm curious if this was driven just by that comment, or if it helps some
case you are thinking about.

If the latter, you also can't go much farther than this though without
ending up writing a general code motion implementation (like
https://courses.cs.washington.edu/courses/cse501/06wi/reading/click-pldi95.pdf),
which i'm not aware of really being used very much in practice.

As an aside, GCC eventually implemented hoisting a problem that shares
GVNPRE's dataflow for the most part (see
https://gcc.gnu.org/bugzilla/attachment.cgi?id=26665)



On Fri, Aug 15, 2014 at 3:36 AM, Erik Verbruggen <erikjv at me.com> wrote:

> When PRE detects a common operation after a basic diamond case and in
> one predecessor in that diamond, then hoist that operation in the common
> dominator of the predecessors instead of moving the operation into the
> predecessor lacking it.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140815/05c4de59/attachment.html>


More information about the llvm-commits mailing list