I have some problems finding dependencies. I want to get the corresponding Alloca from each load (corresponding in terms of the variable used, which means that Load uses a variable based on / dependent on Alloca or Allocas).
Therefore, I have a chain like: Alloca -> Load(1) -> ... -> Computation where the variable might be changed -> Store(new_var) -> ... -> Load(n)
"Computing in which a variable changes" means that: I can Alloca(a), c=a+7000*b[32], Load(c).
At first I tried to use methods from the AliasAnalysis class. The plan was as follows: after I get all the required aliases, I classify them into 2:
- category A: aliases with allocas
- category B: aliases without allocas
For category A, right for what I need. For category B, I check if there is an instruction in which the variable is also used from the instruction from the aliases of category A. If so, this is normal.
For some methods, I cannot use Alloca, so I try to find the dependencies between Loads (I have all the Load instructions in the loadInstrArray array) and then check if some Load uses the same variable as Alloca.
But the following did not give me any result at all (and they should, I have dependencies in the target test code - this means that Load j is used several times in my code, so pointers must be required):
if( AA.isMustAlias(Loci,Locj) ) - No resultsif( AA.alias(Loci,Locj) )- Incorrect results, such as " LOAD %2 = load i32* %j, align 4 IS DEPENDENT ON %3 = load i32* %c, align 4"
where j is completely independent of c
3 ". if( AA.getModRefInfo(allocaInstrArray[j],Loci) )- no results
Loci - AliasAnalysis:: Location from Load, allocaInstrArray - allocas
-, DependencyAnalysis.
if (DA.depends(loadInstrArray[i],loadInstrArray[j],false)) -
-, MemoryDependenceAnalysis - http://llvm.org/docs/doxygen/html/MemDepPrinter_8cpp_source.html.
- , :
%1 = load i32* %j, align 4 IS Clobber FROM: store i32 0, i32* %c, align 4 - DEF ( clobber), Alloca . Loads.
getDef(), Loads . - ,
00131, segfault, - .
, , ?
!