Skip to content

Cache LLVM attributes for intrinsics #21006

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

Merged
merged 3 commits into from
Dec 4, 2018

Conversation

jrose-apple
Copy link
Contributor

Looking these up is slow because the attribute lists get rebuilt and reuniqued in the LLVM context each time. Saving them is a single pointer per IntrinsicInfo and IntrinsicInfos are already cached in each SILModule.

This shaves about 4s off optimizing the standard library (72s out of a 3:00+ build), and probably has much less effect anywhere else. That is, it's not really important after all, but it was an easy bit of the profile to hammer down.

Looking these up is slow because the attribute lists get rebuilt and
reuniqued in the LLVM context each time. Saving them is a single
pointer per IntrinsicInfo and IntrinsicInfos are already cached in
each SILModule.

This shaves about 4s off optimizing the standard library (72s out of a
3:00+ build), and probably has much less effect anywhere else. That
is, it's not /really/ important after all, but it was an easy bit of
the profile to hammer down.
At one point we were probably trying to avoid including
llvm/IR/Intrinsics.h in Builtins.h but that ship has sailed.

No functionality change.
Intrinsics never have custom function type ExtInfo anymore. (This used
to be where the "noreturn" bit lived, but now that's represented by
Swift.Never.)

No functionality change.
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

Turns out SIL optimizations call getMemoryBehavior a lot.

@jrose-apple jrose-apple merged commit b3ca057 into swiftlang:master Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants