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

Severe compile-time time regression in GlobalISel / Legalizer with Swift exposed by d0af732bd00c0390fbcc6f900e8a59eb3954106c #53109

Closed
asl opened this issue Jan 10, 2022 · 7 comments

Comments

@asl
Copy link
Collaborator

asl commented Jan 10, 2022

The downstream issue is https://bugs.swift.org/browse/SR-15531

Consider the attached bitcode. Running llc ConnectionStateMachine.swift.o -O0 after d0af732 bumps the compilation time from 5 seconds to 90 seconds. The majority of time is spent in Legalizer. Adding https://reviews.llvm.org/D109154 reduces the compilation time down to ~25 seconds, but still a huge difference.

As far as I can see, this is a severe compile time regression for Swift 5.5 vs 5.6 affecting e.g. vapor/postgres-nio#205 and some other downstream projects on aarch64

Tagging @TNorthover @ornata

ConnectionStateMachine.swift.o.zip

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 10, 2022

@llvm/issue-subscribers-backend-AArch64

@fhahn fhahn changed the title Severe time regression in GlobalISel / Legalizer with Swift exposed by d0af732bd00c0390fbcc6f900e8a59eb3954106c Severe compile-time time regression in GlobalISel / Legalizer with Swift exposed by d0af732bd00c0390fbcc6f900e8a59eb3954106c Jan 10, 2022
@ornata ornata self-assigned this Jan 14, 2022
@ornata
Copy link

ornata commented Jan 14, 2022

Taking a look at this right now...

@asl
Copy link
Collaborator Author

asl commented Jan 14, 2022

@ornata I think that the problem is only exposed by this revision

@ornata
Copy link

ornata commented Jan 14, 2022

Using trunk LLVM @ acb8de5:

With d0af732

$ time bin/llc -O0 ~/Downloads/ConnectionStateMachine.swift.o
real	0m10.582s
user	0m10.453s
sys	0m0.118s

Without d0af732

$ time bin/llc -O0 ~/Downloads/ConnectionStateMachine.swift.o
real	0m10.673s
user	0m10.554s
sys	0m0.111s

This is on an intel machine though. I'll try a M1 to verify that doesn't make a difference.

(Which LLVM commit is Swift at?)

@asl
Copy link
Collaborator Author

asl commented Jan 14, 2022

@ornata I'm checking with LLVM ToT right now and will keep you updated. Swift is ~ Aug 2021

@asl
Copy link
Collaborator Author

asl commented Jan 15, 2022

Ok, here is the full story. The issue was exposed by d0af732 and fixed in mainline by 64bef13f083b3d980. The underlying issue seems to be quite clear.

Swift is currently using https://github.com/apple/llvm-project/tree/stable/20210726 branch, so was unlucky enough to make this branch in a ~3 week window between these changes :)

I submitted apple#3804 which backports 64bef13f083b3d980

@asl
Copy link
Collaborator Author

asl commented Jan 21, 2022

The PR was merged. So, now it's up to Swift folks to cherry pick to appropriate branches as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants