Skip to content

[IRGen] Cast dynamic alloca to appropriate type. #66014

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 19, 2023

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented May 19, 2023

Fix the type of the alloca created by GenPack for type metadata and witness tables by fixing its callee, emitDynamicAlloca to always return a StackAddress whose Address' type is the one specified by the caller.

rdar://109540863

@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@@ -454,6 +454,8 @@ irgen::emitTypeMetadataPack(IRGenFunction &IGF,
auto pack = IGF.emitDynamicAlloca(IGF.IGM.TypeMetadataPtrTy, shape,
IGF.IGM.getPointerAlignment(),
/*allowTaskAlloc=*/true);
pack = pack.withAddress(IGF.Builder.CreateElementBitCast(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this inside emitDynamicAlloca() or is it not worth refactoring since we're switching to opaque pointers at some point?

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, let's do that.

Fix the type of the `alloca` created by `GenPack`'s for type metadata
and witness tables by fixing its callee, `emitDynamicAlloca` to always
return a `StackAddress` whose `Address`' type is the one specified by
the caller.

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

@swift-ci please test

@nate-chandler nate-chandler changed the title [GenPack] Cast dynamic alloca to appropriate type. [IRGen] Cast dynamic alloca to appropriate type. May 19, 2023
@nate-chandler nate-chandler merged commit efe762d into swiftlang:main May 19, 2023
@nate-chandler nate-chandler deleted the rdar109540863 branch May 19, 2023 14:00
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