Skip to content

Commit c822615

Browse files
committed
Optimizer: convert the UpdateBorrowedFromPass pass to a test
And remove the now empty TestPasses directory.
1 parent bff873d commit c822615

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2294
-2034
lines changed

SwiftCompilerSources/Sources/Optimizer/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ add_subdirectory(InstructionSimplification)
1717
add_subdirectory(PassManager)
1818
add_subdirectory(ModulePasses)
1919
add_subdirectory(FunctionPasses)
20-
add_subdirectory(TestPasses)
2120
add_subdirectory(Utilities)

SwiftCompilerSources/Sources/Optimizer/PassManager/PassRegistration.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ private func registerSwiftPasses() {
146146
registerForSILCombine(ApplyInst.self, { run(ApplyInst.self, $0) })
147147
registerForSILCombine(TryApplyInst.self, { run(TryApplyInst.self, $0) })
148148
registerForSILCombine(EndCOWMutationAddrInst.self, { run(EndCOWMutationAddrInst.self, $0) })
149-
150-
// Test passes
151-
registerPass(updateBorrowedFromPass, { updateBorrowedFromPass.run($0) })
152149
}
153150

154151
private func registerSwiftAnalyses() {

SwiftCompilerSources/Sources/Optimizer/TestPasses/CMakeLists.txt

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

SwiftCompilerSources/Sources/Optimizer/TestPasses/UpdateBorrowedFrom.swift

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

SwiftCompilerSources/Sources/SIL/Utilities/PhiUpdater.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,13 @@ func registerPhiUpdater() {
263263
public let notifyInstructionChanged: (Instruction) -> () = { inst in }
264264
}
265265
}
266+
267+
//===--------------------------------------------------------------------===//
268+
// Tests
269+
//===--------------------------------------------------------------------===//
270+
271+
let updateBorrowedFromTest = Test("update_borrowed_from") {
272+
function, arguments, context in
273+
274+
updateBorrowedFrom(in: function, context)
275+
}

SwiftCompilerSources/Sources/SIL/Utilities/Test.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public func registerTests() {
147147
smallProjectionPathTest,
148148
getAccessBaseTest,
149149
accessPathTest,
150+
updateBorrowedFromTest,
150151
borrowIntroducersTest,
151152
enclosingValuesTest,
152153
forwardingDefUseTest,

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ PASS(StripObjectHeaders, "strip-object-headers",
130130
"Sets the bare flag on objects which don't need their headers")
131131
PASS(StackPromotion, "stack-promotion",
132132
"Stack Promotion of Class Objects")
133-
PASS(UpdateBorrowedFrom, "update-borrowed-from",
134-
"Test pass for update borrowed-from instructions")
135133
PASS(MandatoryTempRValueElimination, "mandatory-temp-rvalue-elimination",
136134
"Mandatory remove short-lived immutable temporary copies")
137135
PASS(TempRValueElimination, "temp-rvalue-elimination",

test/SIL/OwnershipVerifier/borrow_scope_introducing_operands_positive.sil

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -update-borrowed-from -enable-sil-verify-all=0 -o /dev/null %s 2>&1
1+
// RUN: %target-sil-opt -enable-sil-verify-all=0 -o /dev/null %s 2>&1
22

33
// REQUIRES: asserts
44

@@ -192,7 +192,8 @@ bb1:
192192
bb2:
193193
%borrow2 = begin_borrow %0 : $C
194194
br bb3(%borrow2 : $C, %0 : $C)
195-
bb3(%borrow3 : @guaranteed $C, %copy3 : @owned $C):
195+
bb3(%11 : @guaranteed $C, %copy3 : @owned $C):
196+
%borrow3 = borrowed %11 from (%copy3)
196197
end_borrow %borrow3 : $C
197198
destroy_value %copy3 : $C
198199
%result = tuple ()

0 commit comments

Comments
 (0)