Skip to content

Commit e8c65b3

Browse files
committed
Remove the optimize.sil.preserve_exclusivity attribute.
1 parent dda3d7b commit e8c65b3

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
@@ -615,41 +615,6 @@ internal enum KeyPathComponent: Hashable {
615615
}
616616
}
617617

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

705670
// Begin a 'modify' access to the address. This access is ended in
706671
// ClassHolder's deinitializer.
707-
beginAccessHelper(address._rawValue, accessRecordPtr, type)
672+
Builtin.beginUnpairedModifyAccess(address._rawValue, accessRecordPtr, type)
708673

709674
return holder
710675
}
@@ -714,7 +679,7 @@ internal final class ClassHolder<ProjectionType> {
714679
let accessRecordPtr = Builtin.projectTailElems(self, AccessRecord.self)
715680

716681
// Ends the access begun in _create().
717-
endAccessHelper(accessRecordPtr)
682+
Builtin.endUnpairedAccess(accessRecordPtr)
718683
}
719684
}
720685

@@ -1265,7 +1230,8 @@ internal struct RawKeyPathComponent {
12651230
// Perform an instaneous record access on the address in order to
12661231
// ensure that the read will not conflict with an already in-progress
12671232
// 'modify' access.
1268-
instantaneousAccessHelper(offsetAddress._rawValue, NewValue.self)
1233+
Builtin.performInstantaneousReadAccess(offsetAddress._rawValue,
1234+
NewValue.self)
12691235
return .continue(offsetAddress
12701236
.assumingMemoryBound(to: NewValue.self)
12711237
.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)