Skip to content

[IRGen] Other instructions whose ops/results have packs may allocate pack metadata. #67569

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 4 commits into from
Jul 28, 2023

Conversation

nate-chandler
Copy link
Contributor

Based on #67567 .

Instead of assuming that the list of instructions known to allocate pack metadata is exhaustive and returning false from mayRequirePackMetadata for all others, consider the types of the results and operands of other instructions and look for packs.

When it's a tuple containing a pack.
Add the recursive property.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please test linux platform

lib/AST/Type.cpp Outdated
RecursiveTypeProperties::HasArchetype, InterfaceType,
ConformsTo, Superclass, Layout, GenericEnv) {
RecursiveTypeProperties::HasArchetype |
RecursiveTypeProperties::HasConcretePack,
Copy link
Contributor

Choose a reason for hiding this comment

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

It’s actually PackExpansionType that leads us into this situation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's a PackExpansionType whose pattern is a PackArchetypeType:

(tuple_type num_elements=1
  (tuple_type_elt
    (pack_expansion_type
      (pattern=pack_archetype_type address=0x127045b10
        (interface_type=dependent_member_type assoc_type=Swift.(file).Sequence.Element
          (base=generic_type_param_type depth=0 index=0 decl=main.(file).tupleExpansionWithMemberType(seqs:elts:)[email protected]:1:47 pack)) name=(each T).Element
)
      (count=pack_archetype_type address=0x127045880
        (interface_type=generic_type_param_type depth=0 index=0 decl=main.(file).tupleExpansionWithMemberType(seqs:elts:)[email protected]:1:47 pack) conforms_to=Swift.(file).Sequence name=each T
))))

Eliminated HasConcretePack and added HasPack and HasPackArchetype.
Renamed the old `hasPack` to `hasAnyPack`; as before, it means that the
type has a parameter pack, a pack, or a pack archetype.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Instead of assuming that the list of instructions known to allocate pack
metadata is exhaustive and returning false from mayRequirePackMetadata
for all others, consider the types of the results and operands of other
instructions and look for packs.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler merged commit c67f4ff into swiftlang:main Jul 28, 2023
@nate-chandler nate-chandler deleted the rdar112792831-3 branch July 28, 2023 14:07
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