[LLVMdev] MemoryDependenceAnalysis

Anthony Danalis adanalis at eecs.utk.edu
Mon Apr 13 12:01:52 PDT 2009


I'm attaching the .bc file.  Note that my analysis pass is invoked  
after "-O1" and that's why the IR I included in the original email is  
optimized.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_loops_F2_4list.bc
Type: application/octet-stream
Size: 6384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090413/779e1ae8/attachment.obj>
-------------- next part --------------

On Apr 13, 2009, at 2:21 PM, Chris Lattner wrote:

> On Apr 13, 2009, at 9:06 AM, Anthony Danalis wrote:
>> Hello,
>>
>> I have a code similar to the following:
>
> Hi Anthony,
>
> Can you please attach the .bc file for this?
>
> -Chris
>
>>
>>
>>        program test
>>            integer i, j, N
>>            real B(10)
>>
>>            call bar(N, 8)
>>            N = N+1
>>            do i = 1, N
>>                B(i) = (i+5)/(i+3)
>>            enddo
>>
>>            j = N/2
>>            N = N+7
>>
>>            call IMPORTANT_F(B, N, i, j)
>>
>>        end program
>>
>> 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
>>        ret void
>>
>> 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)
>> and
>> N = N+7  (store i32 %12, i32* %n, align 4)
>> are the ones that define the parameters "j" and "N" respectively?
>>
>> thanks,
>> Anthony
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list