[llvm-dev] SCEV cannot compute the trip count of Simple loop

Mehdi Amini via llvm-dev
2016-09-16T21:29:57Z

> On Sep 16, 2016, at 2:23 PM, Sanjoy Das <sanjoy at
playingwithpointers.com> wrote:
>
> Hi Mehdi,
>
> Mehdi Amini wrote:
> >
> >> On Sep 16, 2016, at 1:56 PM, Kevin Choi via llvm-dev
> >> <llvm-dev at lists.llvm.org <mailto:llvm-dev at
lists.llvm.org>> wrote:
> >>
> >> > int mat[9][9][9];
> >> > for (p = (x+1) ; p < (x+3) ;p++)
> >> > mat[x][p-1][i] = mat[x][p-1][i] + 5;____
> >> > }
> >> The trip count of 2 should be valid for x in [0,6].
> >
> > It is not clear to me why the trip count of 2 isn’t *always* valid.
>
> It is always valid to return 2 as the trip count.  But SCEV today is
> not always able to exploit nsw/nuw due to some systemic issues.

I understood that SCEV can’t deduce it.
The point was more “abstracting the current implementation limitation”, there is
no fundamental issue with this code.

—
Mehdi