[PATCH] D31843: [LCSSA] Try to not walk the dominator tree more than necessary

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 18:18:06 PDT 2017


For and exit block to be immediately dominated by something outside the
loop, it implies not all paths from that dominator, to the exit block, go
through the loop.
Loop simplify claims to transform all loops for that to not be true (IE
that all loop exits are dominated by the header)
If we allow lcssa for non-loopsimplify'd loops, then the following would
suffice:


     | --- A
     |      |
     |      B<-
     |      |    |
     |--->C --
            |
           D

C is the loop exit block, and it is immediately dominated by A.


On Wed, Apr 12, 2017 at 6:03 PM, Davide Italiano via Phabricator <
reviews at reviews.llvm.org> wrote:

> davide added inline comments.
>
>
> ================
> Comment at: lib/Transforms/Utils/LCSSA.cpp:90
>      Loop *L = LI.getLoopFor(InstBB);
> +    assert(L && "tinky winky");
>      if (!LoopExitBlocks.count(L))
> ----------------
> Please ignore this assert, it helped me to find bugs during the
> development, I think it can committed separately (with a proper message)
>
>
> ================
> Comment at: lib/Transforms/Utils/LCSSA.cpp:274-277
> +    // Exit blocks can have an immediate dominator which doesn't belong to
> +    // the loop, I think. XXX: this may be overcautious, check again.
> +    if (!L.contains(IDomBB))
> +      continue;
> ----------------
> I'm not entirely sure if this one is needed. I'll try to find examples
> where this can happen && remove and see if that triggers failures in the
> testsuite.
>
>
> https://reviews.llvm.org/D31843
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/28a4630f/attachment.html>


More information about the llvm-commits mailing list