[llvm-commits] Patch to improve loop-simplify

Andrew Clinton ajclinto at gmail.com
Wed Mar 2 23:56:38 PST 2011


The role of the loop-simplify pass, as described in the header, is to
transform natural loops into a simpler form.  The goal of this patch
is not to produce the minimum number of instructions but to ensure
that additional (unnecessary) complexity is not introduced by the
simplification.  I think this is a good change since running the
natural loops analysis after this pass will then produce the expected
loop nesting.  Without this patch, I have found it necessary to write
a new pass that merges the nested loops.

I believe that other passes will clean up extra branching (CFG
simplification), and PHI nodes will usually add runtime complexity
only for the incoming blocks.  So I wouldn't expect runtime
performance to be impacted by this change.

Attached is the revised diff - thank you for the feedback!

Andrew

On Thu, Mar 3, 2011 at 2:10 AM, Cameron Zwarich <zwarich at apple.com> wrote:
> Is splitting an edge to create a unique loop backedge better than creating two loops? If the inner loop's backedge is more frequently taken, then you are trading an extra unconditional branch (with phis) on loop entry for an extra unconditional branch (with phis) along the inner loop's backedge. When is this a good trade?
>
> Cameron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nestedloops.diff
Type: text/x-patch
Size: 6228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110303/c2855a90/attachment.bin>


More information about the llvm-commits mailing list