Hi Preston,<br><br>I am trying to use DA as well. I used your example and commands that you wrote in order to get DA information. <br><br>However, it does not report any dependence info. <br><br>I am wondering whether your local copy differs from the one on the repository ?<br>
<br>Thanks.<br>Erkan.<br><br><br><br><div class="gmail_quote">On Fri, Nov 9, 2012 at 2:40 PM, Preston Briggs <span dir="ltr"><<a href="mailto:preston.briggs@gmail.com" target="_blank">preston.briggs@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"><div>Hi,</div><div><br></div><div>The DependenceAnalysis pass will find loop-carried dependences. However, it is a conservative analysis and will sometimes suggest there may be more dependences than actually exist. In your example, I expect the analysis is confused for some reason and is returning the default confused response. You could test it using the isConfused() method. Note that the DVEntry::ALL direction is always valid. A distance of NULL is similarly valid; it merely indicates that the analysis couldn't figure out a fixed distance (or perhaps one doesn't exit).</div>

<div><br></div><div>In your example, there's certainly a dependence from the load to the store. I'd expect it to report a consistent, loop-carried anti dependence with distance -1, and it does for me. Here's the test program I used:</div>

<div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">void zip(double *arr) {</font></div>

</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">  for (int i = 1; i < 100; i++) {</font></div></div></div></div><div class="gmail_extra"><div class="gmail_quote">

<div><div><font face="courier new, monospace">    arr[i] = arr[i-1];</font></div></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">  }</font></div></div></div>

</div><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">}</font></div></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>and here's how I compiled things:</div>

<div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="arial, helvetica, sans-serif">clang -c -emit-llvm zip.c -o zip.bc</font></div>

</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="arial, helvetica, sans-serif">opt -basicaa -mem2reg -simplifycfg -loop-simplify -loop-rotate -simplifycfg -instcombine -indvars -da -analyze zip.bc</font></div>

</div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Some of the passes may not be necessary, but they're what I use by default. In this case, -analyze tests 3 pairs of memory references, the load against itself, the load versus the store, and the store against itself. It reports:</div>

<div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div>da analyze - consistent input [0|<]!</div></div></div></div><div class="gmail_extra">

<div class="gmail_quote"><div><div>da analyze - consistent anti [-1]!</div></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div>da analyze - consistent output [0|<]!</div></div></div></div></blockquote>

<div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Hope this helps,</div><div>Preston</div><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Hello everyone,<br><br>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?<br>


<br>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.  <br>


<br>E.g, for this input loop:<br>for (int i = 1; i < 100; i++)<br>{<br>    arr[i] = arr[i-1];<br>}<br><br>This dependence is reported:<br>%1 = load i32* %arrayidx.i, align 4  --->   store i32 %1, i32* %arrayidx2.i, align 4<br>


<br>And the following is the code to output distance and directions.  nestingLevel is the innermost loop depth, 1 in this case.<br><br>Dependence* dependence = dependenceAnalysis->depends(instructions[src], instructions[dst], true);<br>


if (dependence)<br>{<br>    unsigned direction = dependence->getDirection(nestingLevel); // Returns DVEntry::ALL<br>    if (const SCEV* scev = dependence->getDistance(nestingLevel))  // Returns null<br>    {...}<br>


}<br><br></blockquote></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best Regards,<br>Erkan Diken<br>------------------<br><br>