[PATCH] D73064: [LoopCacheAnalysis]: Add support for negative stride
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 08:49:23 PST 2020
jdoerfert added a comment.
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?
================
Comment at: llvm/lib/Analysis/LoopCacheAnalysis.cpp:359
+ // The array may be accessed in reverse, for example:
+ //
----------------
The example code is not really helpful here.
================
Comment at: llvm/lib/Analysis/LoopCacheAnalysis.cpp:381
+ AccessFnAR->getNoWrapFlags());
+ }
const SCEV *Div = SE.getUDivExactExpr(AccessFn, ElemSize);
----------------
No braces.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73064/new/
https://reviews.llvm.org/D73064
More information about the llvm-commits
mailing list