Full IRGen support for begin_access [no_nested_conflict].

Suppress generation of the endAccess runtime call when the
begin_access was a "non-tracking" access.
This commit is contained in:
Andrew Trick
2018-03-31 16:40:01 -07:00
parent 6af333f307
commit 02e4429dba
2 changed files with 6 additions and 2 deletions

View File

@@ -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());
}
@@ -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 });

View File

@@ -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)