[PATCH] D43245: [LoopInterchange] Support reductions across inner and outer loop.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 09:38:01 PST 2018

fhahn created this revision.
fhahn added reviewers: mcrosier, efriedma, karthikthecool, davide.

This patch adds logic to detect reductions across the inner and outer
loop by following the incoming values of PHI nodes in the outer loop. If
the incoming values take part in a reduction in the inner loop or come
from outside the outer loop, we found a reduction spanning across inner
and outer loop.

It also moves the logic to handle reduction PHI nodes to the end of
adjustLoopBranches. Reduction PHI nodes in the outer loop header can be moved
to the inner loop header and reduction PHI nodes from the inner loop
header can be moved to the outer loop header. In the latter situation, we
have to deal with 2 kinds of PHI nodes:

1. PHI nodes that are part of a reduction in the outer loop
2. PHI nodes that are part of inner loop-only reductions.

For 1) we only have to move the PHI node and update the incoming blocks.
For 2) we can replace the PHI node with the value coming from outside the
inner loop.

With this change, an additional ~400 loops are interchanged in the LLVM test-suite.

Fixes https://bugs.llvm.org/show_bug.cgi?id=30472



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43245.134062.patch
Type: text/x-patch
Size: 11450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180213/945b82a2/attachment.bin>

More information about the llvm-commits mailing list