[PATCH] D90290: [LoopInterchange] Prevent Loop Interchange for non-affine value store to affine access
Geng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 02:31:52 PDT 2020
geng created this revision.
geng added reviewers: hfinkel, fhahn, karthikthecool.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
geng requested review of this revision.
In the following case
#include <stdio.h>
int a;
int c[4][4];
void test_deps() {
for (int i = 0; i <= 3; i++) {
for (int j = 0; j <= 3; j++) {
a ^= 0x1000;
c[j][i] = a;
}
}
}
main() {
test_deps();
for (int k = 0; k < 4; k++)
printf("%d\n", c[0][k]);
}
If we do the loop interchange, there will be correctness issues. However, the loop interchange can not be prevent by dependence matrix. The reason is that we have only one multi-dimensional array access c[j][i] within the loop, other accesses are scalar access. This patch is supposed to prevent loop interchange from the above case. We think the root cause of correctness issue is that the non-affine value (scalar) is stored to affine address (multi-dimensional array access).
This patch closes https://bugs.llvm.org/show_bug.cgi?id=47915
https://reviews.llvm.org/D90290
Files:
llvm/lib/Transforms/Scalar/LoopInterchange.cpp
llvm/test/Transforms/LoopInterchange/non-affine-store-to-affine.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90290.301194.patch
Type: text/x-patch
Size: 6085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201028/f6b7dddd/attachment.bin>
More information about the llvm-commits
mailing list