I have a code similar to the following:
integer i, j, N
call bar(N, 8)
N = N+1
do i = 1, N
B(i) = (i+5)/(i+3)
j = N/2
N = N+7
call IMPORTANT_F(B, N, i, j)
and I am trying to use dependence analysis on the second and fourth actual parameters of IMPORTANT_F(). Since it's Fortran, they are really pointers, and the IR of the last block looks like this:
%11 = sdiv i32 %1, 2 ; <i32> [#uses=1]
store i32 %11, i32* %j, align 4
%12 = add i32 %0, 8 ; <i32> [#uses=1]
store i32 %12, i32* %n, align 4
call void (...)* @IMPORTANT_F_([10 x float]* %b, i32* %n, i32* %i, i32* %j) nounwind
My problem is that if I use getNonLocalPointerDependency() I get the instruction "N=N+1" as a Def for the second parameter, "N", and no Def for the fourth, "j", (only the call to "bar()" as clobber).
If I use getDependency() on the call, I get the instruction "N=N+7" as a clobber.
How can I use MemoryDependenceAnalysis (or any other analysis for that matter) to gather that the instructions
j = N/2 (store i32 %11, i32* %j, align 4)
N = N+7 (store i32 %12, i32* %n, align 4)
are the ones that define the parameters "j" and "N" respectively?