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

Tobias Grosser tobias at grosser.es
Sat Oct 1 14:55:46 PDT 2011

On 10/01/2011 03:26 PM, Marcello Maggioni wrote:
> Hello everyone,
> I'm trying to use LLVM+Polly to obtain a polyhedral representation of
> some loops to use later for passes I want to implement, but seems like
> Polly will stop when reaching any statement that has non-affine access
> functions of the loop bounds discarding the whole SCoP entirely.
> What I would like to achieve is still getting some information for the
> statements that , instead, have affine access functions, practically
> "ignoring" the non-affine ones.
> There is a way to do such a thing?

Hi Marcello,

this is not yet integrated into Polly, but a very valuable extension 
which I planned to integrate myself. In case you want to give it a try,
I am very glad to help you.

Basically, what you want is to adapt lib/Analysis/ScopDetection.cpp to
not reject non-affine constructs. In lib/Analysis/ScopInfo.cpp we would
need to adapt the translation into the polyhedral description. Instead 
of creating a map defining an affine must access (such as
Stmt[i,j] -> A[2 * i + j]), we create a map that defines a may access to 
all elements of the corresponding array. Something like 'Stmt[i,j] -> A[x]'.


More information about the llvm-dev mailing list