<div dir="ltr">Assuming compiler assumes program is free of UB, I suppose trip count of 2 is always valid. I misplaced valid to trip count when it should've been "program is valid only for x in [0.6]".</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 2:29 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Sep 16, 2016, at 2:23 PM, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.<wbr>com</a>> wrote:<br>
><br>
> Hi Mehdi,<br>
><br>
> Mehdi Amini wrote:<br>
> ><br>
> >> On Sep 16, 2016, at 1:56 PM, Kevin Choi via llvm-dev<br>
> >> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a> <mailto:<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.<wbr>org</a>>> wrote:<br>
> >><br>
> >> > int mat[9][9][9];<br>
> >> > for (p = (x+1) ; p < (x+3) ;p++)<br>
> >> > mat[x][p-1][i] = mat[x][p-1][i] + 5;____<br>
> >> > }<br>
> >> The trip count of 2 should be valid for x in [0,6].<br>
> ><br>
> > It is not clear to me why the trip count of 2 isn’t *always* valid.<br>
><br>
> It is always valid to return 2 as the trip count.  But SCEV today is<br>
> not always able to exploit nsw/nuw due to some systemic issues.<br>
<br>
</span>I understood that SCEV can’t deduce it.<br>
The point was more “abstracting the current implementation limitation”, there is no fundamental issue with this code.<br>
<br>
—<br>
<span class="HOEnZb"><font color="#888888">Mehdi<br>
<br>
</font></span></blockquote></div><br></div>