[LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?

Arnamoy Bhattacharyya arnamoy at ualberta.ca
Wed Jun 20 14:33:58 PDT 2012


Hi;

I was playing with the -lda pass of LLVM on the following program-

#include <stdio.h>
void main()
{
int a[10];
int i;
for(i = 0; i < 4; i ++)
{
a[i] = a[i-1]+1;
}
}

I run the following commands -

clang a.c -emit-llvm -S
opt -analyze -stats -lda a.s

The output is -

Printing analysis 'Loop Dependence Analysis':
Loop at depth 1, header block: %for.cond
  Load/store instructions: 7
0:   %0 = load i32* %i, align 4
1:   %4 = load i32* %i, align 4
2:   store i32 %inc, i32* %i, align 4
3:   %1 = load i32* %i, align 4
4:   %2 = load i32* %arrayidx, align 4
5:   %3 = load i32* %i, align 4
6:   store i32 %add, i32* %arrayidx1, align 4
  Pairwise dependence results:
0,2: dependent
0,6: dependent
1,2: dependent
1,6: dependent
2,3: dependent
2,4: dependent
2,5: dependent
2,6: dependent
3,6: dependent
4,6: dependent
5,6: dependent
===-------------------------------------------------------------------------===
                          ... Statistics Collected ...
===-------------------------------------------------------------------------===

11 lda - Number of dependence queries answered
11 lda - Number of distinct dependence pairs analysed
11 lda - Number of pairs with unknown accesses

Why do the " Pairwise dependence results:" and the "Statistics Collected"
differ?  Like first we get 11 "dependent"(must) accesses and later it says
11 "unknown" (may) accesses?  Am I doing anything wrong or the code seems
buggy?

Thanks;
-- 
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Alberta, Canada, T6G 2E8
587-710-7073
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120620/2dc31fde/attachment.html>


More information about the llvm-dev mailing list