Skip to content

[TypeLowering] Record packs used in signatures. #81581

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 1 commit into from
May 21, 2025

Conversation

nate-chandler
Copy link
Contributor

To determine whether an instruction may require pack metadata, the types of its operands are examined.

Previously, the top level type was checked for having a pack in its signature, and the whole type was checked for having a type anywhere in its layout (via TypeLowering). This didn't account for the case where the metadata was required for a resilient type which uses a pack in its signature.

Here, during type lowering, a type having a pack in its signature is counted towards the type having a pack.

Fixes a compiler crash.

rdar://147207926

To determine whether an instruction may require pack metadata, the types
of its operands are examined.

Previously, the top level type was checked for having a pack in its
signature, and the whole type was checked for having a type anywhere in
its layout (via TypeLowering).  This didn't account for the case where
the metadata was required for a resilient type which uses a pack in its
signature.

Here, during type lowering, a type having a pack in its signature is
counted towards the type having a pack.

Fixes a compiler crash.

rdar://147207926
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please test source compatibility

@nate-chandler
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@nate-chandler
Copy link
Contributor Author

@swift-ci please test macos platform

@nate-chandler
Copy link
Contributor Author

@swift-ci please test linux platform

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please test linux platform

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

LGTM

@nate-chandler nate-chandler marked this pull request as ready for review May 21, 2025 20:37
@nate-chandler nate-chandler merged commit 3934652 into swiftlang:main May 21, 2025
7 of 8 checks passed
@nate-chandler nate-chandler deleted the rdar147207926 branch May 21, 2025 20:37
hamishknight added a commit to hamishknight/swift that referenced this pull request May 22, 2025
nate-chandler added a commit to nate-chandler/swift that referenced this pull request Jun 6, 2025
Every `LowerType::visit*` function eventually calls through to a
`LowerType::handle*` function.  After
swiftlang#81581, every
`LowerType::handle*` needs to set the `hasPack` flag based on the
passed-in type by calling `mergeHasPack`.  Add the missing call in the
`handleAggregateByProperties` function.

rdar://152580661
nate-chandler added a commit to nate-chandler/swift that referenced this pull request Jun 6, 2025
Every `LowerType::visit*` function eventually calls through to a
`LowerType::handle*` function.  After
swiftlang#81581, every
`LowerType::handle*` needs to set the `hasPack` flag based on the
passed-in type by calling `mergeHasPack`.  Add the missing call in the
`handleAggregateByProperties` function.

rdar://152580661
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