Skip to content

Full IRGen support for begin_access [no_nested_conflict]. #15659

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 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4260,8 +4260,8 @@ static SILAccessEnforcement getEffectiveEnforcement(IRGenFunction &IGF,
return enforcement;
}

template <class Inst>
static ExclusivityFlags getExclusivityFlags(Inst *i) {
template <class BeginAccessInst>
static ExclusivityFlags getExclusivityFlags(BeginAccessInst *i) {
return getExclusivityFlags(i->getModule(), i->getAccessKind(),
i->hasNoNestedConflict());
}
Expand Down Expand Up @@ -4363,6 +4363,9 @@ void IRGenSILFunction::visitEndAccessInst(EndAccessInst *i) {
return;

case SILAccessEnforcement::Dynamic: {
if (access->hasNoNestedConflict())
return;

auto scratch = getLoweredDynamicEnforcementScratchBuffer(access);

auto call = Builder.CreateCall(IGM.getEndAccessFn(), { scratch });
Expand Down
1 change: 1 addition & 0 deletions test/IRGen/access_markers.sil
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ bb0(%0 : $A):
// CHECK: call void @swift_beginAccess(i8* %{{.*}}, [[BUFFER]]* %{{.*}}, [[SIZE]] 0, i8* null)
%3 = begin_access [read] [dynamic] [no_nested_conflict] %2 : $*Int
copy_addr %3 to [initialization] %1 : $*Int
// CHECK-NOT: end_access
end_access %3 : $*Int
%9 = alloc_stack $Builtin.UnsafeValueBuffer
// CHECK: call void @swift_beginAccess(i8* %{{.*}}, [[BUFFER]]* %{{.*}}, [[SIZE]] 0, i8* null)
Expand Down