Skip to content

Commit 15305aa

Browse files
authored
Merge pull request #18222 from eeckstein/remove-padt-bench
benchmarks: Convert the PartialApplyDynamicType into a lit test
2 parents 98f3961 + 53f2660 commit 15305aa

File tree

4 files changed

+29
-45
lines changed

4 files changed

+29
-45
lines changed

benchmark/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ set(SWIFT_BENCH_MODULES
113113
single-source/ObserverUnappliedMethod
114114
single-source/OpaqueConsumingUsers
115115
single-source/OpenClose
116-
single-source/PartialApplyDynamicType
117116
single-source/Phonebook
118117
single-source/PointerArithmetics
119118
single-source/PolymorphicCalls

benchmark/single-source/PartialApplyDynamicType.swift

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

benchmark/utils/main.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ import ObserverPartiallyAppliedMethod
103103
import ObserverUnappliedMethod
104104
import OpaqueConsumingUsers
105105
import OpenClose
106-
import PartialApplyDynamicType
107106
import Phonebook
108107
import PointerArithmetics
109108
import PolymorphicCalls
@@ -267,7 +266,6 @@ registerBenchmark(ObserverPartiallyAppliedMethod)
267266
registerBenchmark(ObserverUnappliedMethod)
268267
registerBenchmark(OpaqueConsumingUsers)
269268
registerBenchmark(OpenClose)
270-
registerBenchmark(PartialApplyDynamicType)
271269
registerBenchmark(Phonebook)
272270
registerBenchmark(PointerArithmetics)
273271
registerBenchmark(PolymorphicCalls)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %target-swift-frontend -O -emit-ir %s
2+
3+
// Test that this does not crash
4+
5+
protocol P {
6+
func f(_ i: Int) -> Int
7+
}
8+
9+
func g<T: P>(_ t: T) -> ((T) -> (Int) -> Int) {
10+
let f = { type(of: t).f($0) }
11+
return f
12+
}
13+
14+
class C: P {
15+
func f(_ i: Int) -> Int {
16+
return i + 1
17+
}
18+
}
19+
20+
let c = C()
21+
22+
public func test_PartialApplyDynamicType() -> Int {
23+
var result = 0
24+
for _ in 1...100000 {
25+
result += g(c)(c)(1)
26+
}
27+
return result
28+
}
29+

0 commit comments

Comments
 (0)