forked from CompOpt4Apps/IEGenLib
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
In the computation_example, the first computation is the following:
for(int k = 0; k < 2*n-1; k++)
S: C[k] = 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
T: C[i+j] += A[i] * B[j];
When addStmt is called with T, enforceSSA does a renaming of C, and generates the following code at the end:
#define s_0(k) C__w__0[k] = 0
#define s0(c_0, k, c_2) s_0(k);
#define s_1(i, j) C[i+j] = C__w__0[i+j] + A[i] * B[j]
#define s1(c_0, i, j) s_1(i, j);
t1 = 0;
t2 = 0;
for(t2 = 0; t2 <= 2*n-2; t2++) {
s0(0,t2,0);
}
for(t2 = 0; t2 <= n-1; t2++) {
for(t3 = 0; t3 <= n-1; t3++) {
s1(1,t2,t3);
}
}
The problem here is that the second loop is now doing C[i+j] = C__w__0[i+j] + A[i] * B[j] rather than using the same C variable.
My understanding of SSA with array accesses is limited, but it looks like there's supposed to be a phi node somewhere for C and C__w__0.
Metadata
Metadata
Assignees
Labels
No labels