This is an archive of the discontinued LLVM Phabricator instance.

[LoopInterhcange] Handle movement of reduction phis appropriately during transformation (pr43326 && pr48212)
ClosedPublic

Authored by congzhe on May 18 2021, 8:38 PM.

Details

Summary

This patch fixes pr43326(https://bugs.llvm.org/show_bug.cgi?id=43326) and pr48212(https://bugs.llvm.org/show_bug.cgi?id=48212). The test cases in pr43326 and pr48212 are added in lit tests.

Currently when we move reduction phis to the right place, this pass assumes the first phi in loop headers is an induction phi, skips the first phi and assume the rest of phis are candidate reduction phis to move. However, it may not always be the case.

This patch loops over all phis in loop headers and consider an phi as a candidate reduction phi to move only when it is indeed a reduction phi across outer and inner loop.

Diff Detail

Event Timeline

congzhe created this revision.May 18 2021, 8:38 PM
congzhe requested review of this revision.May 18 2021, 8:38 PM
congzhe edited the summary of this revision. (Show Details)May 18 2021, 8:39 PM
congzhe updated this revision to Diff 346333.May 18 2021, 8:46 PM
congzhe retitled this revision from [LoopInterhcange] Handle movement of reduction phis appropriately during transformation to [LoopInterhcange] Handle movement of reduction phis appropriately during transformation (pr43326 && pr48212).May 18 2021, 8:51 PM
congzhe updated this revision to Diff 346344.May 18 2021, 10:33 PM
Whitney accepted this revision.May 30 2021, 9:47 AM
Whitney added inline comments.
llvm/lib/Transforms/Scalar/LoopInterchange.cpp
10

This line can now be removed.

This revision is now accepted and ready to land.May 30 2021, 9:47 AM
congzhe updated this revision to Diff 348712.May 30 2021, 3:27 PM

Minor comments addressed

congzhe updated this revision to Diff 348858.May 31 2021, 1:04 PM
This revision was landed with ongoing or failed builds.May 31 2021, 1:30 PM
This revision was automatically updated to reflect the committed changes.