[LLVMdev] Using DependenceAnalysis::depends

Tobias Grosser tobias at grosser.es
Thu Jan 2 06:47:28 PST 2014


On 12/27/2013 07:38 PM, Snehasish Kumar wrote:
> Hi Preston,
>
> Thank you for the prompt response.
>
> You can use DependenceAnalysis to get the info you want by expensively
>> testing all pairs of memory references.
>
>
> Isn't all pairs testing incorrect in the sense that a pair may only exist
> for a certain path? Consider the following example.
>
> A[i] = 42;          // S1
> if( condition )      // C1
> {
>      A[i] = 20;       // S2
> }
> B[i] = A[i];         // S3
>
> Testing for all pairs would indicate that there exists a WAR between S2 and
> S3 but it is only correct if C1 evaluates to true.
> Similarly, there may or may not be a WAW between S1 and S2. Thus to clearly
> indicate the possible paths I would like to generate something like:
>
> C1 (true) : WAW - S2->S1 , RAW - S3->S2
> C1 (false) : WAW - S3->S1
>
> So then it seems to me that building the dependence graph is essential.
>
> Are there no other Analysis/Transforms which require this type of
> information?
> I looked at AESOP (http://aesop.ece.umd.edu/doc/aesop-white-paper.pdf)
> which implements an autoparallelization framework and it seems they would
> need to do similar checks, the page hosting the code is currently offline.

Hi Snehasish,

you may want to look at polly.llvm.org. It has a very detailed 
dependence analysis that also takes into accounts control flow 
conditions. (Such kind of analysis are important e.g. when generating 
GPU code, but also for other more complex loop transformations).

Cheers,
Tobias




More information about the llvm-dev mailing list