Skip to content

[IRGen] Deadends don't need dealloc_pack_metadata. #73191

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
Apr 24, 2024

Conversation

nate-chandler
Copy link
Contributor

There is a debug-build-only verification that is done for alloc_pack_metadata instructions that checks that there exist paired dealloc_pack_metadata instructions which will be keyed off of to clean up the on-stack variadic metadata packs corresponding to (the instruction after) the alloc_pack_metadata.

StackNesting omits the deallocation instruction (as does PackMetadataMarkerInserter) if it would be created in a dead end block. If all blocks in the dominance frontier of the alloc_pack_metadata instruction are dead-end blocks, then the verification will incorrectly fail. It should not fail because it is not necessary to clean up the on-stack pack metadata (or any other stack allocations) in such a case.

If all such blocks are dead-end blocks, however, the alloc_pack_metadata's block itself is a dead-end block as well. So during the verification, check whether the alloc_pack_metadata occurs in a dead-end block and do not fail verification if it does.

rdar://125265980

There is a debug-build-only verification that is done for
alloc_pack_metadata instructions that checks that there exist paired
dealloc_pack_metadata instructions which will be keyed off of to clean
up the on-stack variadic metadata packs corresponding to (the
instruction after) the alloc_pack_metadata.

StackNesting omits the deallocation instruction (as does
PackMetadataMarkerInserter) if it would be created in a dead end block.
If all blocks in the dominance frontier of the alloc_pack_metadata
instruction are dead-end blocks, then the verification will incorrectly
fail.  It should not fail because it is not necessary to clean up the
on-stack pack metadata (or any other stack allocations) in such a case.

If all such blocks are dead-end blocks, however, the
alloc_pack_metadata's block itself is a dead-end block as well.  So
during the verification, check whether the alloc_pack_metadata occurs in
a dead-end block and do not fail verification if it does.

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

@swift-ci please test

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

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

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