-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Remove a stale UnenforcedAccess marker from SILGenPattern. #22452
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
Conversation
@swift-ci test. |
lib/SILGen/SILGenPattern.cpp
Outdated
// The boxed value may be shared, so we need to load the value at +0 | ||
// to make sure that we copy if we try to use it outside of the switch | ||
// statement itself. | ||
boxedValue = SGF.B.createLoadBorrow(loc, boxedValue); | ||
boxedValue = SGF.B.createLoadBorrow(loc, accessAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to check here like in the other place if the scope closes immediately (in which case you use a copy, no?)
Build failed |
Build failed |
NFC unless -enable-verify-exclusivity is on. Boxed (indirect) enum loads are not formal accesses so they should not have access markers. For a while, we used UnenforcedAccess in this case to signal to the verifier that this is actually a safe load. But that isn't needed. The verifier just ignores loads from unidentified storage instead. There are two code paths that had this UnenforcedAccess marker. One was cleaned up, and the other was not. So finish the cleanup and add a unit test for both SILGen code paths.
@swift-ci please test |
@gottesmm Revisiting this old PR. Should be a quick review, no hurry. |
@@ -385,6 +385,31 @@ enum IntEnum { | |||
// CHECK: load [trivial] [[PROJ]] : $*Int | |||
// CHECK-LABEL: } // end sil function '$s20access_marker_verify7IntEnumO8getValueSivg' | |||
|
|||
// Also test SILGenPattern for address-only enums with indirect loadable payloads. | |||
enum IntTEnum<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test case for:
indirect enum
That is missing in the code-coverage.
@@ -2151,37 +2146,20 @@ void PatternMatchEmission::emitEnumElementDispatch( | |||
|
|||
// If the payload is boxed, project it. | |||
if (elt->isIndirect() || elt->getParentEnum()->isIndirect()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice how here we check for getParentEnum().isIndirect. That is the case to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gottesmm that is the test case that I added.
Build failed |
@swift-ci test linux platform. |
Remove a stale UnenforcedAccess marker from SILGenPattern.