-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[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
[sil-optimizer] At -Onone serialize when running the Onone optimizati… #21822
Conversation
@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? |
@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(); |
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.
If you're adding this here, don't you need to remove an explicit serialize
call from the Frontend?
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.
No. This can be seen by noting that the perf pipeline does the exact same thing without issue.
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.
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.
9df9fb4
to
4fd4593
Compare
SM->serialize(); | ||
|
||
if (haveModulePath) { | ||
if (PSPs.haveModuleOrModuleDocOutputPaths()) { |
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.
Ah, hm. I wonder why this was ever guarding the index stuff. Well, this is definitely what it was doing before, so 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.
cc @benlangmuir
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.
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.
Thanks Jordan! |
@swift-ci test and merge |
…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.