[llvm] [LAA] Keep pointer checks on partial analysis (PR #139719)
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 09:05:16 PDT 2025
john-brawn-arm wrote:
> Would it be possible to make this behavior opt-in? Otherwise we unnecessarily increase compile-time for all other users that do not need this, just to benefit LoopVerLICM which isn't on by default.
>
> Expanding low/end for groups can be costly in some cases.
Doing a simple test with the following:
{code}
void fn(char *p, char *q, char **r, int n) {
#define LOOP \
for (int i = 0; i < n; i++) { \
p[i] += q[i] + r[0][i]; \
p[i] += q[i+1] + r[1][i]; \
p[i] += q[i+2] + r[2][i]; \
p[i] += q[i+3] + r[3][i]; \
p[i] += q[i+4] + r[4][i]; \
p[i] += q[i+5] + r[5][i]; \
}
#define DO10 LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP
#define DO100 DO10 DO10 DO10 DO10 DO10 DO10 DO10 DO10 DO10 DO10
#define DO1000 DO100 DO100 DO100 DO100 DO100 DO100 DO100 DO100 DO100 DO100
DO1000
}
{code}
and doing:
- Compile with clang -O2 -emit-llvm
- Run ``opt -passes="print<access-info>" -disable-output --time-trace`` 20 times with and without this change
- Get the duration of LoopAccessAnalysis (which is in microseconds) from the time trace file
I get:
Without: mean 1307, median 1347, standard deviation 119
With: mean 1301, median 1335, standard deviation 116
So it looks like any increase in compile-time is negligible and well within the measurement noise, for this test case at least.
https://github.com/llvm/llvm-project/pull/139719
More information about the llvm-commits
mailing list