Skip to content
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
2 changes: 2 additions & 0 deletions lib/SILOptimizer/Transforms/DeadObjectElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ static bool onlyStoresToTailObjects(BuiltinInst *destroyArray,

// Check if the destroyArray destroys the tail elements of allocRef.
auto destroyPath = AccessPath::compute(destroyArray->getArguments()[1]);
if (!destroyPath.isValid())
return false;
AccessStorage storage = destroyPath.getStorage();
if (auto *beginDealloc = dyn_cast<BeginDeallocRefInst>(storage.getRoot())) {
destroyPath = AccessPath(
Expand Down
17 changes: 17 additions & 0 deletions validation-test/SILOptimizer/rdar162237650.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %target-swift-frontend -c -O %s -target %target-swift-6.0-abi-triple

// REQUIRES: synchronization

import Synchronization

class Locked<T> {
let mutex: Mutex<T>

init(_ rawValue: T) {
mutex = Mutex(rawValue)
}
}

class Foo {}

_ = Locked(Foo())