Skip to content

[sil-optimizer] At -Onone serialize when running the Onone optimizati… #21822

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

Conversation

gottesmm
Copy link
Contributor

…on pipeline instead of after running SIL passes.

NOTE: This is not in the mandatory passes (which run before this). This will
enable me to strip out ownership after we serialize without touching frontend
code. It also makes Onone and O use the same code paths for serialization
instead of one happening in the driver (Onone today) and the other in a SIL pass
(-O, -Osize).

The reason that I updated the sil-func-extractor test is that I found a bug in
how we emit sib files, namely if you try to emit a sib file to stdout, the
llvm-bcanalyzer flags it as malformed. If I output the .sib into a file rather
than trying to use stdout, everything works.

@gottesmm gottesmm requested a review from jrose-apple January 12, 2019 22:41
@gottesmm
Copy link
Contributor Author

@jrose-apple I am going to file an SR for the invalid sib being emitted when we emit sib to -o -. The llvm-bcanalyzer says it has a bad record. That feels outside of the scope of this change. Your thoughts?

@gottesmm
Copy link
Contributor Author

@swift-ci test

@@ -635,6 +635,9 @@ SILPassPipelinePlan SILPassPipelinePlan::getOnonePassPipeline() {
// Has only an effect if the -gsil option is specified.
P.addSILDebugInfoGenerator();

// Finally serialize the SIL if we are asked to.
P.addSerializeSILPass();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're adding this here, don't you need to remove an explicit serialize call from the Frontend?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This can be seen by noting that the perf pipeline does the exact same thing without issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jordan and I spoke offline. He agreed with me that the sib problem is out of scope and I should file an SR for this. We agreed on the changes he wants in the frontend. I am going to update the PR.

…on pipeline instead of after running SIL passes.

NOTE: This is not in the mandatory passes (which run before this). This will
enable me to strip out ownership after we serialize without touching frontend
code. It also makes Onone and O use the same code paths for serialization
instead of one happening in the driver (Onone today) and the other in a SIL pass
(-O, -Osize).

The reason that I updated the sil-func-extractor test is that I found a bug in
how we emit sib files, namely if you try to emit a sib file to stdout, the
llvm-bcanalyzer flags it as malformed. If I output the .sib into a file rather
than trying to use stdout, everything works.
@gottesmm gottesmm force-pushed the pr-8d2416681ea41244ae3c2bd3d3d3bb35fcc1eade branch from 9df9fb4 to 4fd4593 Compare January 14, 2019 18:34
SM->serialize();

if (haveModulePath) {
if (PSPs.haveModuleOrModuleDocOutputPaths()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, hm. I wonder why this was ever guarding the index stuff. Well, this is definitely what it was doing before, so thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a guard for indexing, it's an early exit from this function that predates indexing. If we're in the situation that early-exits, we need to index at this point. Otherwise we will index after IRGen below on line 1312.

@gottesmm
Copy link
Contributor Author

Thanks Jordan!

@gottesmm
Copy link
Contributor Author

@swift-ci test and merge

3 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci test and merge

@gottesmm
Copy link
Contributor Author

@jrose-apple https://bugs.swift.org/browse/SR-9660

@swift-ci swift-ci merged commit cd8f565 into swiftlang:master Jan 14, 2019
@gottesmm gottesmm deleted the pr-8d2416681ea41244ae3c2bd3d3d3bb35fcc1eade branch January 14, 2019 20:56
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.

4 participants