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 class="Apple-interchange-newline">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">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><br><br><br>On Sun, Mar 25, 2012 at 9:49 PM, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.com</a>> wrote:<br>> 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">https://github.com/sanjoy/llvm/tree/lda</a><br>
> --<br>> Sanjoy Das.<br>> <a href="http://playingwithpointers.com">http://playingwithpointers.com</a><br></div>