Wait Are you really setting isGT to true if the distance is less than zero?<div>If so, I think your code is ok, but the naming could use a rework.</div><div><br></div><div>Preston<br><br><div class="gmail_quote">On Thu, Apr 5, 2012 at 4:09 PM, Preston Briggs <span dir="ltr"><<a href="mailto:preston.briggs@gmail.com">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">Hi Sanjoy,<br><br>Reading through LoopDependenceAnalysis::analyseStrongSIV(), I noticed one problem and one confusion.<br>
<br>My confusion related to your naming of the two instructions as A and B. It's consistent all through LoopDependenceAnalysis. I'd prefer something like source and destination, so I can keep track of which is which. It didn't matter so much when you were simply proving or disproving dependence, but when you compute direction, it's suddenly crucial.<br>

<br>The problem is the computation of direction from distance. The code says:<div><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="'courier new', monospace">if (distance->isZero())</font></div>

<div><font face="'courier new', monospace">  S->Direction = Subscript::EQ;</font></div><div><font face="'courier new', monospace">else if (isGT)</font></div><div><font face="'courier new', monospace">  S->Direction = Subscript::GT;</font></div>

<div><font face="'courier new', monospace">else</font></div><div><font face="'courier new', monospace">  S->Direction = Subscript::LT;</font></div></blockquote><div><br></div><div>While it looks sensible, it's incorrect. Correct is</div>

<div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">

<div><font face="'courier new', monospace"><br>if (distance->isZero())</font></div><div><font face="'courier new', monospace">  S->Direction = Subscript::EQ;</font></div>
<div><font face="'courier new', monospace">else if (isGT)</font></div><div><font face="'courier new', monospace">  S->Direction = Subscript::LT; // !!</font></div><div><font face="'courier new', monospace">else</font></div>

<div><font face="'courier new', monospace">  S->Direction = Subscript::GT; // !!</font></div></blockquote><div><br></div></div>The Delta test paper (Section 1.3) and the 1st printing of Allen & Kennedy (Definition 2.10) are similarly incorrect.</div>

<div>See <a href="http://www.elsevierdirect.com/companion.jsp?ISBN=9781558602861" target="_blank">http://www.elsevierdirect.com/companion.jsp?ISBN=9781558602861</a></div><div>particularly the replacement for page 46.<br>
<br>I'm also confused about the math, but I'll keep working on it.</div>
<div><br></div><div>Thanks,</div><div>Preston</div><div><div class="im"><br><br><br>On Sun, Mar 25, 2012 at 9:49 PM, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>> wrote:<br>
</div><div><div class="h5">> Hi Hal, Preston!<br>
><br>> Sorry for the delay!  Got busy with some offline work.<br>><br>> I've worked on my previous code to calculate direction and distance<br>> vectors whenever possible (strong SIV, basically).  I think the<br>

> current code is much clearer and would like your opinions on it.<br>><br>> I have attached the patch and also pushed to the github repo I<br>> mentioned [1].<br>><br>> Thanks!<br>><br>> [1] <a href="https://github.com/sanjoy/llvm/tree/lda" target="_blank">https://github.com/sanjoy/llvm/tree/lda</a><br>

> --<br>> Sanjoy Das.<br>> <a href="http://playingwithpointers.com" target="_blank">http://playingwithpointers.com</a><br></div></div></div>
</blockquote></div><br></div>