Skip to content

Commit ba58d3c

Browse files
authored
Merge pull request #15659 from atrick/irgen-endaccess
Full IRGen support for begin_access [no_nested_conflict].
2 parents 7bc8994 + 02e4429 commit ba58d3c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,8 +4260,8 @@ static SILAccessEnforcement getEffectiveEnforcement(IRGenFunction &IGF,
42604260
return enforcement;
42614261
}
42624262

4263-
template <class Inst>
4264-
static ExclusivityFlags getExclusivityFlags(Inst *i) {
4263+
template <class BeginAccessInst>
4264+
static ExclusivityFlags getExclusivityFlags(BeginAccessInst *i) {
42654265
return getExclusivityFlags(i->getModule(), i->getAccessKind(),
42664266
i->hasNoNestedConflict());
42674267
}
@@ -4363,6 +4363,9 @@ void IRGenSILFunction::visitEndAccessInst(EndAccessInst *i) {
43634363
return;
43644364

43654365
case SILAccessEnforcement::Dynamic: {
4366+
if (access->hasNoNestedConflict())
4367+
return;
4368+
43664369
auto scratch = getLoweredDynamicEnforcementScratchBuffer(access);
43674370

43684371
auto call = Builder.CreateCall(IGM.getEndAccessFn(), { scratch });

test/IRGen/access_markers.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ bb0(%0 : $A):
155155
// CHECK: call void @swift_beginAccess(i8* %{{.*}}, [[BUFFER]]* %{{.*}}, [[SIZE]] 0, i8* null)
156156
%3 = begin_access [read] [dynamic] [no_nested_conflict] %2 : $*Int
157157
copy_addr %3 to [initialization] %1 : $*Int
158+
// CHECK-NOT: end_access
158159
end_access %3 : $*Int
159160
%9 = alloc_stack $Builtin.UnsafeValueBuffer
160161
// CHECK: call void @swift_beginAccess(i8* %{{.*}}, [[BUFFER]]* %{{.*}}, [[SIZE]] 0, i8* null)

0 commit comments

Comments
 (0)