[LLVMdev] How to make Polly ignore some non-affine memory accesses

Marcello Maggioni
Fri, 07 Oct 2011 14:43:12 -0000

I add also the output of these commands:

[hades at artemis examples]$ ./compile_ex.sh super_simple_loop
Printing analysis 'Polly - Detect Scops in functions' for function
'main':

[hades at artemis examples]$

modifying it in :

 #include <stdio.h>

 int main()
 {
         int A[1024];
         int j, k=10;
         for (j = 0; j < 1024; j++)
                 A[j] = k;

       return 0;
}

gives:

[hades at artemis examples]$ ./compile_ex.sh super_simple_loop
Printing analysis 'Polly - Detect Scops in functions' for function
'main':
Valid Region for Scop: %1 => %5

[hades at artemis examples]$

2011/10/7 Marcello Maggioni <hayarms at
gmail.com>:
> Hi,
>
> for example this loop:
>
>  #include <stdio.h>
>
>  int main()
>  {
>          int A[1024];
>          int j, k=10;
>          for (j = 1; j < 1024; j++)
>                  A[j] = k;
>
>        return 0;
> }
>
> run with:
>
> #!/bin/bash
> source ../set_path.source
> clang -S -emit-llvm $1.c -o $1.s
> opt -S -mem2reg -loop-simplify -indvars $1.s > $1.preopt.ll
> opt -load ${PATH_TO_POLLY_LIB}/LLVMPolly.so -polly-detect -analyze
$1.preopt.ll
>
> Using the instructions found on the Polly website.
>
>
> 2011/10/7 Tobias Grosser <tobias at grosser.es>:
>> On 10/07/2011 03:25 PM, Marcello Maggioni wrote:
>>>
>>> Hi, I'd like to ask another thing about Polly and SCoP
discarding.
>>>
>>> I've noticed that Polly discards quite simple loops like:
>>>
>>> for (int i = 1; i<  1000; i++) {}
>>>
>>> or
>>>
>>> for (int i= 0; i<  1000; i+=2) {}
>>>
>>> is this an intended behavior or there is some way to make it accept
>>> these kind of loops?
>>
>> Hi Marcello,
>>
>> can you provide complete test cases and explain how you run Polly.
These
>> loop constructs contain nothing Polly cannot handle, but other parts of
your
>> programs may block a detailed analysis. Furthermore, Polly relies on
LLVM
>> preparing passes to canonicalize the code. If they
>> are not run beforehand than Polly will hardly detect any loops.
>>
>> In your case I propose you attach the complete C and LLVM-IR files and
>> explain how you run Polly. I am sure I can help you with this.
>>
>> Tobi
>>
>