[llvm-commits] [llvm] r163091 - in /llvm/trunk: lib/Transforms/Scalar/LoopRotation.cpp test/Transforms/LoopRotate/multiple-exits.ll

Daniel Berlin dberlin at dberlin.org
Sun Sep 2 06:06:17 PDT 2012


On Sun, Sep 2, 2012 at 7:57 AM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Sun Sep  2 06:57:22 2012
> New Revision: 163091
>
> URL: http://llvm.org/viewvc/llvm-project?rev=163091&view=rev
> Log:
> LoopRotation: Make the brute force DomTree update more brute force.
>
> We update until we hit a fixpoint. This is probably slow but also
> slightly simplifies the code. It should also fix the occasional
> invalid domtrees observed when building with expensive checking.
>
> I couldn't find a case where this had a measurable slowdown, but
> if someone finds a pathological case where it does we may have
> to find a cleverer way of updating dominators here.
>

FWIW:
It's not easily possible to do much better.

Take a look at http://gcc.gnu.org/viewvc/trunk/gcc/dominance.c?revision=190389&view=markup
starting at line 1236 and you'll see what I mean.

The "cleverer" way past simple iterative fixup of dominators usually
involves building reduced (or annotated) graphs and running a
dominator computation on them, which is quite complicated in practice.

(GCC implemented it when the number of bb's needing to be updated was
small, say, 10, but the size of the function overall was quite larger,
say a thousand bb's, and the standard iterative fixpoint was too
expensive).

Frankly, even with pathological cases, it may not be worth fixing for
the complexity it usually brings.



More information about the llvm-commits mailing list