Skip to content

Conversation

kavon
Copy link
Member

@kavon kavon commented Oct 9, 2025

The prior emission strategy produced some scary SIL where we have a copy of uninitialized memory:

 ignored_use %14 %16 = alloc_stack $T unreachable bb1: copy_addr [take] %16 to [init] %0 dealloc_stack %16 

I assume this was done to dodge the SILVerifier, which will catch a take of an uninitialized address, had the alloc_stack been in any reachable predecessor.

We already have a representation for an undefined value in SIL, so I'd rather use that than try to sneak one past the verifier.

This adjusted emission also is opaque values friendly, as it doesn't assume the result value is an address.

resolves rdar://162239557

@kavon kavon requested a review from jckarter as a code owner October 9, 2025 00:39
@kavon
Copy link
Member Author

kavon commented Oct 9, 2025

@swift-ci smoke test

@kavon kavon enabled auto-merge October 9, 2025 00:45
The prior emission strategy produced some scary SIL where we have a copy of uninitialized memory: ``` ignored_use %14 %16 = alloc_stack $T unreachable bb1: copy_addr [take] %16 to [init] %0 dealloc_stack %16 ``` I assume this was done to dodge the SILVerifier, which will catch a take of an uninitialized address, had the alloc_stack been in any reachable predecessor. We already have a representation for an undefined value in SIL, so I'd rather use that than try to sneak one past the verifier. This adjusted emission also is opaque values friendly, as it doesn't assume the result value is an address. resolves rdar://162239557
@kavon kavon force-pushed the opaque-values/unreachable-expr-rdar162239557 branch from 1cbeb9f to 1e28b0a Compare October 9, 2025 17:39
@kavon
Copy link
Member Author

kavon commented Oct 9, 2025

@swift-ci smoke test

@kavon kavon merged commit 8458226 into swiftlang:main Oct 9, 2025
3 checks passed
@kavon kavon deleted the opaque-values/unreachable-expr-rdar162239557 branch October 10, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant