Skip to content

Fix SynthesizedFileUnit serialization and TBDGen issues. #30912

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 2 commits into from
Apr 9, 2020

Conversation

dan-zheng
Copy link
Contributor

@dan-zheng dan-zheng commented Apr 9, 2020

Fix SynthesizedFileUnit serialization and TBDGen issues exposed in TF-1239.

Make SynthesizedFileUnit attached to a SourceFile. This seemed like the
least ad-hoc approach to avoid doing unnecessary work for other FileUnits.

TBDGen: when visiting a SourceFile, also visit its SynthesizedFileUnit if
it exists.

Serialization: do not treat SynthesizedFileUnit declarations as xrefs when
serializing the companion SourceFile.


Upstream AutoDiff tests validating that TF-1239 is fixed.
Unblocks end-to-end differentiation, particularly cross-module compilation use cases.

Make `SynthesizedFileUnit` attached to a `SourceFile`. This seemed like the
least ad-hoc approach to avoid doing unnecessary work for other `FileUnit`s.

TBDGen: when visiting a `SourceFile`, also visit its `SynthesizedFileUnit` if
it exists.

Serialization: do not treat `SynthesizedFileUnit` declarations as xrefs when
serializing the companion `SourceFile`.

Resolves TF-1239: AutoDiff test failures.
Upstream `SynthesizedFileUnit` failing tests from TF-1239.
@dan-zheng
Copy link
Contributor Author

dan-zheng commented Apr 9, 2020

This continues SynthesizedFileUnit added in #30845 based on feedback here.

Some context: the SILOptimizer differentiation transform generates both struct and enum declarations and adds them to a SynthesizedFileUnit. To avoid generating declarations in SILOptimizer: struct declarations could be replaced with tuples, at the cost of gravely hurting SIL readability. But enum declarations are not easily replaceable.

Related discussion about generating declarations in SILOptimizer: #30736 (comment)

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@dan-zheng
Copy link
Contributor Author

Merging to unblock progress. Happy to address any feedback later!

@dan-zheng dan-zheng merged commit 3999b8b into swiftlang:master Apr 9, 2020
@dan-zheng dan-zheng deleted the fix-synthesized-file-unit branch April 9, 2020 07:30
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