mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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 });
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user