Skip to content

Commit 293fb5a

Browse files
committed
Remove the optimize.sil.preserve_exclusivity attribute.
1 parent 6521d0c commit 293fb5a

File tree

5 files changed

+4
-320
lines changed

5 files changed

+4
-320
lines changed

include/swift/Strings.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#ifndef SWIFT_STRINGS_H
1414
#define SWIFT_STRINGS_H
1515

16-
#include "swift/Basic/LLVM.h"
17-
#include "llvm/ADT/StringRef.h"
18-
1916
namespace swift {
2017

2118
/// The extension for serialized modules.
@@ -92,10 +89,6 @@ constexpr static const char BUILTIN_TYPE_NAME_VEC[] = "Builtin.Vec";
9289
constexpr static const char BUILTIN_TYPE_NAME_SILTOKEN[] = "Builtin.SILToken";
9390
/// The name of the Builtin type for Word
9491
constexpr static const char BUILTIN_TYPE_NAME_WORD[] = "Builtin.Word";
95-
96-
constexpr static StringLiteral OPTIMIZE_SIL_PRESERVE_EXCLUSIVITY =
97-
"optimize.sil.preserve_exclusivity";
98-
9992
} // end namespace swift
10093

10194
#endif // SWIFT_STRINGS_H

lib/SILOptimizer/Mandatory/AccessMarkerElimination.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "swift/Basic/Range.h"
3232
#include "swift/SIL/SILFunction.h"
3333
#include "swift/SILOptimizer/PassManager/Transforms.h"
34-
#include "swift/Strings.h"
3534
#include "llvm/Support/CommandLine.h"
3635

3736
using namespace swift;
@@ -190,12 +189,6 @@ struct AccessMarkerEliminationPass : SILModuleTransform {
190189
void run() override {
191190
auto &M = *getModule();
192191
for (auto &F : M) {
193-
if (F.hasSemanticsAttr(OPTIMIZE_SIL_PRESERVE_EXCLUSIVITY)) {
194-
DEBUG(llvm::dbgs() << "Skipping " << F.getName() << ". Found "
195-
<< OPTIMIZE_SIL_PRESERVE_EXCLUSIVITY << " tag!\n");
196-
continue;
197-
}
198-
199192
bool removedAny = AccessMarkerElimination(&F).stripMarkers();
200193

201194
// Only invalidate analyses if we removed some markers.

stdlib/public/core/KeyPath.swift

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -625,41 +625,6 @@ internal enum KeyPathComponent: Hashable {
625625
}
626626
}
627627

628-
// _semantics("optimize.sil.preserve_exclusivity" forces the compiler to
629-
// generate access markers regardless of the current build settings. This way,
630-
// user code that accesses keypaths are properly enforced even if the standard
631-
// library has exclusivity checking internally disabled. The semantic attribute
632-
// must be consistently applied to both the begin and end unpaired access
633-
// markers, otherwise the runtime will fail catastrophically and unpredictably.
634-
// This relies on Swift module serialization occurring before these _semantic
635-
// function are inlined, since inlining would unpredictably cause the attribute
636-
// to be dropped.
637-
//
638-
// An exclusivity violation will report the caller's stack frame location.
639-
// Runtime diagnostics will be improved by inlining this function. However, this
640-
// cannot be marked @transparent because it can't be inlined prior to
641-
// serialization.
642-
@inlinable
643-
@inline(__always)
644-
@_semantics("optimize.sil.preserve_exclusivity")
645-
func beginAccessHelper<T>(_ address: Builtin.RawPointer, _ accessRecordPtr: Builtin.RawPointer, _ type: T.Type) {
646-
Builtin.beginUnpairedModifyAccess(address, accessRecordPtr, type)
647-
}
648-
649-
@inlinable
650-
@inline(__always)
651-
@_semantics("optimize.sil.preserve_exclusivity")
652-
func endAccessHelper(_ accessRecordPtr: Builtin.RawPointer) {
653-
Builtin.endUnpairedAccess(accessRecordPtr)
654-
}
655-
656-
@inlinable
657-
@inline(__always)
658-
@_semantics("optimize.sil.preserve_exclusivity")
659-
func instantaneousAccessHelper<T>(_ address: Builtin.RawPointer, _ type: T.Type) {
660-
Builtin.performInstantaneousReadAccess(address, T.self)
661-
}
662-
663628
// A class that maintains ownership of another object while a mutable projection
664629
// into it is underway. The lifetime of the instance of this class is also used
665630
// to begin and end exclusive 'modify' access to the projected address.
@@ -714,7 +679,7 @@ internal final class ClassHolder<ProjectionType> {
714679

715680
// Begin a 'modify' access to the address. This access is ended in
716681
// ClassHolder's deinitializer.
717-
beginAccessHelper(address._rawValue, accessRecordPtr, type)
682+
Builtin.beginUnpairedModifyAccess(address._rawValue, accessRecordPtr, type)
718683

719684
return holder
720685
}
@@ -724,7 +689,7 @@ internal final class ClassHolder<ProjectionType> {
724689
let accessRecordPtr = Builtin.projectTailElems(self, AccessRecord.self)
725690

726691
// Ends the access begun in _create().
727-
endAccessHelper(accessRecordPtr)
692+
Builtin.endUnpairedAccess(accessRecordPtr)
728693
}
729694
}
730695

@@ -1275,7 +1240,8 @@ internal struct RawKeyPathComponent {
12751240
// Perform an instaneous record access on the address in order to
12761241
// ensure that the read will not conflict with an already in-progress
12771242
// 'modify' access.
1278-
instantaneousAccessHelper(offsetAddress._rawValue, NewValue.self)
1243+
Builtin.performInstantaneousReadAccess(offsetAddress._rawValue,
1244+
NewValue.self)
12791245
return .continue(offsetAddress
12801246
.assumingMemoryBound(to: NewValue.self)
12811247
.pointee)

test/SILGen/preserve_exclusivity.swift

Lines changed: 0 additions & 118 deletions
This file was deleted.

test/SILOptimizer/preserve_exclusivity.swift

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)