forked from OSchip/llvm-project
eac3487510
Motivated by pr43326 (https://bugs.llvm.org/show_bug.cgi?id=43326), where a slightly modified case is as follows. void f(int e[10][10][10], int f[10][10][10]) { for (int a = 0; a < 10; a++) for (int b = 0; b < 10; b++) for (int c = 0; c < 10; c++) f[c][b][a] = e[c][b][a]; } The ideal optimal access pattern after running interchange is supposed to be the following void f(int e[10][10][10], int f[10][10][10]) { for (int c = 0; c < 10; c++) for (int b = 0; b < 10; b++) for (int a = 0; a < 10; a++) f[c][b][a] = e[c][b][a]; } Currently loop interchange is limited to picking up the innermost loop and finding an order that is locally optimal for it. However, the pass failed to produce the globally optimal loop access order. For more complex examples what we get could be quite far from the globally optimal ordering. What is proposed in this patch is to do a "bubble-sort" fashion when doing interchange. By comparing neighbors in `LoopList` in each iteration, we would be able to move each loop onto a most appropriate place, hence this is an approach that tries to achieve the globally optimal ordering. The motivating example above is added as a test case. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D120386 |
||
---|---|---|
.. | ||
call-instructions.ll | ||
currentLimitation.ll | ||
debuginfo.ll | ||
inner-indvar-depend-on-outer-indvar.ll | ||
inner-only-reductions.ll | ||
innermost-latch-uses-values-in-middle-header.ll | ||
interchange-flow-dep-outer.ll | ||
interchange-insts-between-indvar.ll | ||
interchange-no-deps.ll | ||
interchangeable-innerloop-multiple-indvars.ll | ||
interchangeable-outerloop-multiple-indvars.ll | ||
interchangeable.ll | ||
interchanged-loop-nest-3.ll | ||
lcssa-preheader.ll | ||
lcssa.ll | ||
loop-interchange-optimization-remarks.ll | ||
not-interchanged-dependencies-1.ll | ||
not-interchanged-loop-nest-3.ll | ||
not-interchanged-tightly-nested.ll | ||
outer-header-jump-to-inner-latch.ll | ||
outer-only-reductions.ll | ||
perserve-lcssa.ll | ||
phi-ordering.ll | ||
pr43176-move-to-new-latch.ll | ||
pr43326-ideal-access-pattern.ll | ||
pr43326.ll | ||
pr43473-invalid-lcssa-phis-in-inner-exit.ll | ||
pr43797-lcssa-for-multiple-outer-loop-blocks.ll | ||
pr45743-move-from-inner-preheader.ll | ||
pr48212.ll | ||
profitability.ll | ||
reductions-across-inner-and-outer-loop.ll | ||
update-condbranch-duplicate-successors.ll | ||
vector-gep-operand.ll |