[PATCH] D34982: [Polly][WIP] Fully-Indexed static expansion

Bonfante Nicolas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 02:10:45 PDT 2017


niosega added inline comments.


================
Comment at: lib/Transform/MaximalStaticExpansion.cpp:67
+        // Get the new access map (AM)
+        isl_map *NewAccessMap = nullptr; // TODO
+
----------------
By reading and trying to understand the work done in DeLICM and JSONImporter::importAccesses, I had begin the implementation of my pass. But I am stuck in building the new map. For example, if we have the following c code :

```
 for(int i = 0; i<Ni; i++)
   for(int j = 0; j<Ni; j++)
S:     tmp = A[N+i]*tmp;
```

After the pass, we want this :

```
 for(int i = 0; i<Ni; i++)
   for(int j = 0; j<Ni; j++)
T:      tmp[i, j] = A[N+i]*tmp;
```


This means that I want to transform the map of S, [N] -> {S[i,j] -> tmp}, to the map of T, [N] -> {S[i,j] -> tmp[i, j]}. But i was not able to find a way to do that. Anybody has an idea on how to proceed ?


================
Comment at: test/MaximalStaticExpansion/no_optim.ll:1
+; ModuleID = 'pure_c_main.c'
+source_filename = "pure_c_main.c"
----------------
I try to create a test case with the folowing c code :

```
#define Ni 2000

double mse(double A[Ni], int N) {
  int i;
  double tmp = 2;
  for (i = 0; i < Ni; i++) {
    for (int j = 0; j<Ni; j++) {
      tmp = A[N+i]*tmp;
    }
  }
  return tmp;
}
```
I use the following commands to generate the IR :

    clang -O2 -S -emit-llvm pure_c_main.c
    opt -S  -mem2reg -polly-scops -polly-export-jscop pure_c_main.ll

and this command to detect the SCOP :

    opt -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names -polly-scops -analyze  -polly-export-jscop  no_optim.ll

When I use this commands, polly detects scop but the IR is optimize due to the O2 in clang. I'd like to have a non optimize version of the IR so that the IR is directly linked to the c code. But when I remove the -02, polly does not detect any scop. Anybody has an idea why ?




https://reviews.llvm.org/D34982





More information about the llvm-commits mailing list