record delinearization result and reuse it in polyhedral translation
authorSebastian Pop <spop@codeaurora.org>
Tue, 3 Jun 2014 18:16:31 +0000 (18:16 +0000)
committerSebastian Pop <spop@codeaurora.org>
Tue, 3 Jun 2014 18:16:31 +0000 (18:16 +0000)
commit422e33f36334fbac32304ccd7c0f2186cb0b7395
tree764db548b37534014bd2303c8e71cc51222f51ab
parent68c246aad0836b7a948cc4088c85677a36637174
record delinearization result and reuse it in polyhedral translation

Without this patch, the testcase would fail on the delinearization of the second
array:

; void foo(long n, long m, long o, double A[n][m][o]) {
;   for (long i = 0; i < n; i++)
;     for (long j = 0; j < m; j++)
;       for (long k = 0; k < o; k++) {
;         A[i+3][j-4][k+7] = 1.0;
;         A[i][0][k] = 2.0;
;       }
; }

; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[3 + i0, -4 + i1, 7 + i2] };
; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[i0, 0, i2] };

Here is the output of FileCheck on the testcase without this patch:

; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[i0, 0, i2] };
         ^
<stdin>:26:2: note: possible intended match here
 [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[o0] };
 ^

It is possible to find a good delinearization for A[i][0][k] only in the context
of the delinearization of both array accesses.

There are two ways to delinearize together all array subscripts touching the
same base address: either duplicate the code from scop detection to first gather
all array references and then run the delinearization; or as implemented in this
patch, use the same delinearization info that we computed during scop detection.

llvm-svn: 210117
polly/include/polly/ScopDetection.h
polly/lib/Analysis/ScopDetection.cpp
polly/lib/Analysis/ScopInfo.cpp
polly/lib/Analysis/TempScopInfo.cpp
polly/test/ScopInfo/delinearize-together-all-data-refs.ll [new file with mode: 0644]