Skip to content

Fix MemoryLifetimeVerifier and SIL verifier to handle trivial deinitialization #65386

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

Closed
wants to merge 3 commits into from

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Apr 24, 2023

Fix SILVerifier isConsumingOrMutatingArgumentConvention

Consuming a trivial type has no effect, so we return false in that
case. SILGen avoids generating copies and destroys for trivial types when
ownership would otherwise require it.

Fix MemoryLifetimeVerifier to handle trivial deinitialization

Nontrivial values are never deinitialized. SILGen knows this and
avoids emitting copies and destroys for trivial types. This results in
apparent violations of the memory's initialization state.

Fixes rdar://108001491 (SIL verification failed:
Found mutating consuming use of an in_guaranteed parameter?!:
!ImmutableAddressUseVerifier().isMutatingOrConsuming(fArg))

atrick added 3 commits April 23, 2023 14:29
Consuming a trivial type has no effect, so we return false in that
case. SILGen avoids generating copies and destroys for trivial types when
ownership would otherwise require it.

Fixes rdar://108001491 (SIL verification failed:
Found mutating consuming use of an in_guaranteed parameter?!:
!ImmutableAddressUseVerifier().isMutatingOrConsuming(fArg))
Nontrivial values are never deinitialized. SILGen knows this and
avoids emitting copies and destroys for trivial types. This results in
apparent violations of the memory's initialization state.

For forward dataflow, use [clear|kill]NonTrivialBits for operations that deinitialize without deallocating

Fixes rdar://108001491 (SIL verification failed:
Found mutating consuming use of an in_guaranteed parameter?!:
!ImmutableAddressUseVerifier().isMutatingOrConsuming(fArg))
Fixes rdar://108001491 (SIL verification failed:
Found mutating consuming use of an in_guaranteed parameter?!:
!ImmutableAddressUseVerifier().isMutatingOrConsuming(fArg))
@atrick
Copy link
Contributor Author

atrick commented Apr 24, 2023

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Apr 24, 2023

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Apr 24, 2023

@swift-ci benchmark

@atrick
Copy link
Contributor Author

atrick commented Apr 24, 2023

Unrelated

swift-distributed-actors/Sources/DistributedActorsTestKit/ActorTestKit.swift:16:18: error: module 'DistributedCluster' was not compiled for testing
@testable import DistributedCluster
~~~~~~~~~~       ^
error: fatalError

@atrick atrick marked this pull request as draft April 25, 2023 02:18
@atrick
Copy link
Contributor Author

atrick commented Apr 25, 2023

I decided to investigate whether the optimizations that cause these verifier failures can be avoided. So this may have been wasted effort.

@atrick
Copy link
Contributor Author

atrick commented May 2, 2023

Here is an alternate fix for SILGen: #65579

@atrick
Copy link
Contributor Author

atrick commented Jun 8, 2023

Fixed by: #65579

@atrick atrick closed this Jun 8, 2023
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.

1 participant