[PATCH] D73064: [LoopCacheAnalysis]: Add support for negative stride

Rachel Craik via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 08:58:41 PST 2020


rcraik added a comment.

In D73064#1844826 <https://reviews.llvm.org/D73064#1844826>, @jdoerfert wrote:

> Correct me if I'm wrong but it seems you pretend negative steps are positive ones. While this is just a best-effort analysis, it seems wrong.
> Take
>
>   for (i = N; i > 0; i--)
>     A[i] = A[N - i];
>
>
> which should have a different cost than
>
>   for (i = N; i > 0; i--)
>     A[i] = A[i];
>
>
> which is the same as
>
>   for (i = 0; i < N; i++)
>     A[i] = A[i];
>
>
> Can you add these examples to the tests please?


Could you explain why you believe the first test should have a different cost than the second two? The first and last testcase both iterate over the array in a forwards direction (at least in terms of loads) while the middle one is the only one which goes backwards.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73064/new/

https://reviews.llvm.org/D73064





More information about the llvm-commits mailing list