[LLVMdev] about MemoryDependenceAnalysis usage

Willy WOLFF willy.mh.wolff at gmail.com
Mon May 11 08:04:47 PDT 2015


Thanks for your quick answer.
But it's still the same:
opt -o /dev/null test.ll -S -load ./libPlaydep.so -O3 -basicaa -playdep 
--debug-pass=Structure
Pass Arguments:  -targetlibinfo -datalayout -notti -basictti -x86tti 
-no-aa -tbaa -scoped-noalias -assumption-cache-tracker -basicaa 
-verify-di -ipsccp -globalopt -deadargelim -domtree -instcombine 
-simplifycfg -basiccg -prune-eh -inline-cost -inline -functionattrs 
-argpromotion -sroa -domtree -early-cse -lazy-value-info -jump-threading 
-correlated-propagation -simplifycfg -domtree -instcombine -tailcallelim 
-simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa 
-loop-rotate -licm -loop-unswitch -instcombine -scalar-evolution 
-loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -function_tti 
-loop-unroll -memdep -mldst-motion -domtree -memdep -gvn -memdep 
-memcpyopt -sccp -domtree -instcombine -lazy-value-info -jump-threading 
-correlated-propagation -domtree -memdep -dse -adce -simplifycfg 
-domtree -instcombine -barrier -domtree -loops -loop-simplify -lcssa 
-branch-prob -block-freq -scalar-evolution -loop-vectorize -instcombine 
-scalar-evolution -slp-vectorizer -simplifycfg -domtree -instcombine 
-loops -loop-simplify -lcssa -scalar-evolution -function_tti 
-loop-unroll -alignment-from-assumptions -strip-dead-prototypes 
-globaldce -constmerge -playdep -verify -verify-di -print-module
Target Library Information
Data Layout
No target information
Target independent code generator's TTI
X86 Target Transform Info
No Alias Analysis (always returns 'may' alias)
Type-Based Alias Analysis
Scoped NoAlias Alias Analysis
Assumption Cache Tracker
Basic Alias Analysis (stateless AA impl)
   ModulePass Manager
     Debug Info Verifier
     Interprocedural Sparse Conditional Constant Propagation
....
      Module Verifier
     Debug Info Verifier
     Print module to stderr
Pass Arguments:  -no-aa -assumption-cache-tracker -targetlibinfo -basicaa
No Alias Analysis (always returns 'may' alias)
Assumption Cache Tracker
Target Library Information
Basic Alias Analysis (stateless AA impl)
   ModulePass Manager
     Unnamed pass: implement Pass::getPassName()
       Unnamed pass: implement Pass::getPassName()
Pass Arguments:  -assumption-cache-tracker -no-aa -memdep
Assumption Cache Tracker
No Alias Analysis (always returns 'may' alias)
   FunctionPass Manager
     Memory Dependence Analysis
function fct
for this instruction:   store i32 2, i32* %6, align 4, !tbaa !5
deps are:
   %5 = load i32** %4, align 8, !tbaa !1
   store i32 1, i32* %3, align 4, !tbaa !5
   %2 = load i32** %1, align 8, !tbaa !1


On 11/05/2015 16:50, Daniel Berlin wrote:
> add -basicaa to your command line :)
>
> On Mon, May 11, 2015 at 7:15 AM, Willy WOLFF <willy.mh.wolff at gmail.com> wrote:
>> I play a bit more with MemoryDependenceAnalysis by wrapping my pass, and
>> call explicitely BasicAliasAnalysis. Its still using No Alias Analysis.
>>
>> How can I let MemoryDependenceAnalysis use BasicAliasAnalysis?
>>
>> Please, find attached my pass.
>>
>> I call my pass like this: "opt -o /dev/null -S test.ll -load libPlaydep.so
>> -O3 -playdep --debug-pass=Structure"
>> And the output:
>>
>> opt -o /dev/null test.ll -S -load ./libPlaydep.so -O3 -playdep
>> --debug-pass=Structure
>> Pass Arguments:  -targetlibinfo -datalayout -notti -basictti -x86tti -no-aa
>> -tbaa -scoped-noalias -assumption-cache-tracker -basicaa -verify-di -ipsccp
>> -globalopt -deadargelim -domtree -instcombine -simplifycfg -basiccg
>> -prune-eh -inline-cost -inline -functionattrs -argpromotion -sroa -domtree
>> -early-cse -lazy-value-info -jump-threading -correlated-propagation
>> -simplifycfg -domtree -instcombine -tailcallelim -simplifycfg -reassociate
>> -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch
>> -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom
>> -loop-deletion -function_tti -loop-unroll -memdep -mldst-motion -domtree
>> -memdep -gvn -memdep -memcpyopt -sccp -domtree -instcombine -lazy-value-info
>> -jump-threading -correlated-propagation -domtree -memdep -dse -adce
>> -simplifycfg -domtree -instcombine -barrier -domtree -loops -loop-simplify
>> -lcssa -branch-prob -block-freq -scalar-evolution -loop-vectorize
>> -instcombine -scalar-evolution -slp-vectorizer -simplifycfg -domtree
>> -instcombine -loops -loop-simplify -lcssa -scalar-evolution -function_tti
>> -loop-unroll -alignment-from-assumptions -strip-dead-prototypes -globaldce
>> -constmerge -playdep -verify -verify-di -print-module
>> Target Library Information
>> Data Layout
>> No target information
>> Target independent code generator's TTI
>> X86 Target Transform Info
>> No Alias Analysis (always returns 'may' alias)
>> Type-Based Alias Analysis
>> Scoped NoAlias Alias Analysis
>> Assumption Cache Tracker
>> Basic Alias Analysis (stateless AA impl)
>>    ModulePass Manager
>>      Debug Info Verifier
>>      Interprocedural Sparse Conditional Constant Propagation
>>      Global Variable Optimizer
>> .....
>>      FunctionPass Manager
>>        Module Verifier
>>      Debug Info Verifier
>>      Print module to stderr
>> Pass Arguments:  -no-aa -assumption-cache-tracker -targetlibinfo -basicaa
>> No Alias Analysis (always returns 'may' alias)
>> Assumption Cache Tracker
>> Target Library Information
>> Basic Alias Analysis (stateless AA impl)
>>    ModulePass Manager
>>      Unnamed pass: implement Pass::getPassName()
>>        Unnamed pass: implement Pass::getPassName()
>> Pass Arguments:  -assumption-cache-tracker -no-aa -memdep
>> Assumption Cache Tracker
>> No Alias Analysis (always returns 'may' alias)
>>    FunctionPass Manager
>>      Memory Dependence Analysis
>> function fct
>> for this instruction:   store i32 2, i32* %6, align 4, !tbaa !5
>> deps are:
>>    %5 = load i32** %4, align 8, !tbaa !1
>>    store i32 1, i32* %3, align 4, !tbaa !5
>>    %2 = load i32** %1, align 8, !tbaa !1
>>
>>
>> Cheers,
>> Willy
>>
>>
>> On 09/05/2015 16:06, Willy WOLFF wrote:
>>>
>>> Hi,
>>>
>>> I try to use MemoryDependenceAnalysis in a pass to analyse a simple
>>> function:
>>>
>>> void fct (int *restrict*restrict M, int *restrict*restrict L) {
>>> S1:    M[1][1] = 1;
>>> S2:    L[2][2] = 2;
>>> }
>>>
>>> When I iterate over MemoryDependenceAnalysis on the S2 statement, I get
>>> the load instruction for the first depth of the array, that’s ok. But I get
>>> also the load and store for the S1 statement.
>>> I assume the restrict keywoard help the alias analysis to found that
>>> pointers don’t alias.
>>> The prototype of this function in llvm-ir is:
>>> define void @fct(i32** noalias %M, i32** noalias %L) #0 { ….
>>>
>>> Did this noalias attribute say that both pointer of i32** didn’t alias?
>>>
>>> Also, when I check wich AliasAnalysis pass is called with
>>> —debug-pass=Structure, I see that Memory Dependence Analysis use No Alias
>>> Analysis, even if I use -O3 before calling my pass. Can we specify which
>>> AlisAnalysis we want to use inside the pass (in getAnalysisUsage method, or
>>> somewhere else)?
>>>
>>> Regards,
>>> Willy
>>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>

-- 
Willy WOLFF
Etudiant en Master d'informatique à l'Université de Strasbourg
Ingénierie du Logiciel et des Connaissances, 2em année.
06.09.72.81.51 | willy.wolff at etu.unistra.fr




More information about the llvm-dev mailing list