Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-13 regression: -fsave-optimization-record is generating empty files #50984

Open
sylvestre opened this issue Aug 27, 2021 · 6 comments
Open
Labels
bugzilla Issues migrated from bugzilla loopoptim

Comments

@sylvestre
Copy link
Collaborator

Bugzilla Link 51642
Version trunk
OS All
Blocks #50580 #51489
CC @LebedevRI,@serge-sans-paille,@tstellar

Extended Description

echo "
#define N 1536
float A[N][N];
float B[N][N];
float C[N][N];

void init_array()
{
int i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
A[i][j] = (1+(ij)%1024)/2.0;
B[i][j] = (1+(i
j)%1024)/2.0;
}
}
}

int main()
{
int i, j, k;
double t_start, t_end;
init_array();
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
C[i][j] = 0;
for (k = 0; k < N; k++)
C[i][j] = C[i][j] + A[i][k] * B[k][j];
}
}
return 0;
}
" > foo.c
With clang-12:
$ clang-12 -S -fsave-optimization-record -emit-llvm foo.c -o matmul.s
$ ls -al matmul.opt.yaml
-rw-r--r-- 1 sylvestre sylvestre 535 27 août 09:53 matmul.opt.yaml

With clang-13:
$ clang-13 -S -fsave-optimization-record -emit-llvm foo.c -o matmul.s
$ ls -al matmul.opt.yaml
-rw-r--r-- 1 sylvestre sylvestre 0 27 août 09:54 matmul.opt.yaml

@sylvestre
Copy link
Collaborator Author

This is with rc1, I am trying to see if I can reproduce with rc2

@sylvestre
Copy link
Collaborator Author

Same with rc2

@serge-sans-paille
Copy link
Collaborator

I can reproduce on main branch, but I also note that in -O2, everything is fine.
The change seems to be that -O0 still implies (at least) an inlining pass (probably to handle always inline) and that doesn't appear in clang-13.

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@asl asl added this to the LLVM 13.0.1 release milestone Dec 12, 2021
@tstellar
Copy link
Collaborator

The deadline for requesting fixes for the release has passed. This bug is being removed from the LLVM 13.0.1 release milestone. If you have a fix or think this bug is important enough to block the release, please explain why in a comment and add the bug back to the LLVM 13.0.1 release milestone.

@tstellar tstellar removed this from the LLVM 13.0.1 release milestone Dec 21, 2021
@fhahn
Copy link
Contributor

fhahn commented Dec 23, 2021

This is caused by the switch to the new pass manager I think. The only remark that gets emitted by -O0 for the example is from the AlwaysInliner: https://clang.godbolt.org/z/s6srTvP47

It looks like the new pass manager uses a different always-inline implementation, which presumably doesn't emit that remark?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla loopoptim
Projects
None yet
Development

No branches or pull requests

5 participants