[LLVMdev] Loop carried dependence analysis?

Arnaldo arnaldo.cruz at upr.edu
Thu Nov 8 23:47:43 PST 2012


Hello everyone,

I intend to build a pass to profile some benchmarks for loop carried
dependencies.  At first I tried looking at LoopDependenceAnalysis.{h,cpp}
but the files were removed for some reason.  So I continued with the
DependenceAnalysis pass.  But the flow, anti dependence, etc methods are
only reporting sequential and not loop carried dependencies.  Does LLVM
support loop carried dependency analysis?

In addition, the distance and direction for dependent instructions always
have invalid values; Dependence::getDirection() returns DVEntry::ALL which
is the default value and Dependence::getDistance always returns null.

E.g, for this input loop:
for (int i = 1; i < 100; i++)
{
    arr[i] = arr[i-1];
}

This dependence is reported:
%1 = load i32* %arrayidx.i, align 4  --->   store i32 %1, i32*
%arrayidx2.i, align 4

And the following is the code to output distance and directions.
nestingLevel is the innermost loop depth, 1 in this case.

Dependence* dependence = dependenceAnalysis->depends(instructions[src],
instructions[dst], true);
if (dependence)
{
    unsigned direction = dependence->getDirection(nestingLevel); // Returns
DVEntry::ALL
    if (const SCEV* scev = dependence->getDistance(nestingLevel))  //
Returns null
    {...}
}

void ExtractFeatures::getAnalysisUsage(AnalysisUsage &analysisUsage) const
{
    analysisUsage.addRequired<LoopInfo>();
    analysisUsage.addPreserved<LoopInfo>();
    analysisUsage.addRequired<ScalarEvolution>();
    analysisUsage.addPreserved<ScalarEvolution>();
    analysisUsage.addRequired<AliasAnalysis>();
    analysisUsage.addPreserved<AliasAnalysis>();
    analysisUsage.addRequired<MemoryDependenceAnalysis>();
    analysisUsage.addPreserved<MemoryDependenceAnalysis>();
    analysisUsage.addRequired<DependenceAnalysis>();
    analysisUsage.addPreserved<DependenceAnalysis>();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121109/c1f354d1/attachment.html>


More information about the llvm-dev mailing list