[LLVMdev] SIV tests in LoopDependence Analysis, Sanjoy's patch

Preston Briggs preston.briggs at gmail.com
Mon Apr 23 16:01:16 PDT 2012


Hi,

When I write various test cases and explore how they're handled by the code
in LoopDependenceAnalysis::analysePair, I'm surprised. This loop collects
pairs of subscripts from the source and destination refs.

*  // Collect GEP operand pairs (FIXME: use GetGEPOperands from BasicAA),
adding*
*  // trailing zeroes to the smaller GEP, if needed.*
*  GEPOpdsTy destOpds, srcOpds;*
*  for(GEPOperator::const_op_iterator destIdx = destGEP->idx_begin(),*
*                                     destEnd = destGEP->idx_end(),*
*                                     srcIdx = srcGEP->idx_begin(),*
*                                     srcEnd = srcGEP->idx_end();*
*      destIdx != destEnd && srcIdx != srcEnd;*
*      destIdx += (destIdx != destEnd), srcIdx += (srcIdx != srcEnd)) {*
*    const SCEV* destSCEV = (destIdx != destEnd) ? SE->getSCEV(*destIdx) :*
*      GetZeroSCEV(SE);*
*    destOpds.push_back(destSCEV);*
*    const SCEV* srcSCEV = (srcIdx != srcEnd) ? SE->getSCEV(*srcIdx) :*
*      GetZeroSCEV(SE);*
*    srcOpds.push_back(srcSCEV);*
*  }*


But in my various test cases, I never see the loop iterate more than once.
That is, there always seems to be exactly 1 index.  Here's a typical test
case:

*i**nt zap2(long int n, long int A[][n]) {*
*  long int sum = 0;*
*  for (long int i = 0; i < n; i++)*
*    for (long int j = i; j < n; j++)*
*      sum += A[i][j];*
*  return sum;*
*}*


Any ideas about what I'm doing wrong? Could it be that I'm not running
certain important passes?  Here's my current list:

*-basicaa -mem2reg -simplifycfg -loop-simplify -loop-rotate -simplifycfg
-instcombine*


Thanks,
Preston





On Thu, Apr 12, 2012 at 5:14 AM, Sanjoy Das
<sanjoy at playingwithpointers.com>wrote:

> Hi,
>
> Here is a preliminary (monolithic) version you can comment on.  This
> is still buggy, however, and I'll be testing for and fixing bugs over
> the next few days.  I've used your version of the strong siv test.
>
> Thanks!
> --
> Sanjoy Das.
> http://playingwithpointers.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120423/cb4a1044/attachment.html>


More information about the llvm-dev mailing list