-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Frontend] Set up output file .swiftmodule.summary #33324
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
[Frontend] Set up output file .swiftmodule.summary #33324
Conversation
d917510
to
165af08
Compare
@swift-ci please test |
b86aac2
to
322490e
Compare
@swift-ci please test |
Build failed |
Build failed |
Hmm, it seems the failure is not related to my change 🤔 Would you mind to trigger CI again? |
@swift-ci please test |
This seems reasonable to me, though, Id like to see if @brentdax or @DougGregor have any thoughts on the naming. |
@brentdax @DougGregor If you have time, could you take a look at this PR? |
I would use either I'm also wondering if "summary" is the right term to use—it's very vague. But if it's a term of art in the LTO world, it might be appropriate. |
Ok, I prefer
In LLVM thin LTO world, "summary" is often used.
|
b868daf
to
c44904b
Compare
Updated to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm requesting some tiny changes, but these are basically just formatting things. Functionally, your PR looks fine.
include/swift/Basic/FileTypes.def
Outdated
@@ -51,6 +51,7 @@ TYPE("swiftmodule", SwiftModuleFile, "swiftmodule", "") | |||
TYPE("swiftdoc", SwiftModuleDocFile, "swiftdoc", "") | |||
TYPE("swiftinterface", SwiftModuleInterfaceFile, "swiftinterface", "") | |||
TYPE("private-swiftinterface", PrivateSwiftModuleInterfaceFile, "private.swiftinterface", "") | |||
TYPE("swiftmodulesummary", SwiftModuleSummaryFile, "swiftmodulesummary", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You'll need an additional space here to fix the alignment of the columns.
@@ -454,6 +454,17 @@ def emit_module_interface_path : | |||
ArgumentIsPath, SupplementaryOutput]>, | |||
MetaVarName<"<path>">, HelpText<"Output module interface file to <path>">; | |||
|
|||
def emit_module_summary : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would put these new entries either above emit_module_interface
or below emit_private_module_interface_path
to avoid splitting the module interface options from each other.
auto summaryOutputPath = PSPs.SupplementaryOutputs.ModuleSummaryOutputPath; | ||
return withOutputFile(Context.Diags, summaryOutputPath, | ||
[&](llvm::raw_ostream &out) { | ||
out << "Some stuff"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just quickly checking: if the tools that are meant to consume these files read Some stuff
, will they break in an obvious way? (I don't know what you eventually intend for these files to look like.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, swiftmodulesummary will be serialized into LLVM bitcode stream, so if deserializer reads this text, it will fail due to signature checking.
c44904b
to
b0a2bb6
Compare
This comment has been minimized.
This comment has been minimized.
b0a2bb6
to
4716890
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4716890
to
2930fe7
Compare
This comment has been minimized.
This comment has been minimized.
This patch focus on teaching frontend and driver to emit this file. The actual serialization and deserialization implementation will come later.
2930fe7
to
43fb346
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Hi @brentdax, would you be able to have another look at this PR? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Happy merging!
Module summary file contains symbol dependency information and it's similar to LLVM thin LTO information.
This new file will be used for cross dead function elimination
This patch focus on teaching frontend and driver to emit this file. The actual serialization and deserialization implementation will come later PRs.
For more info: https://forums.swift.org/t/refactoring-plan-of-silvisitor-for-lto/37678/14
CC: @compnerd @gottesmm