Skip to content

benchmarks: Convert the PartialApplyDynamicType into a lit test #18222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2018
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
1 change: 0 additions & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ set(SWIFT_BENCH_MODULES
single-source/ObserverUnappliedMethod
single-source/OpaqueConsumingUsers
single-source/OpenClose
single-source/PartialApplyDynamicType
single-source/Phonebook
single-source/PointerArithmetics
single-source/PolymorphicCalls
Expand Down
42 changes: 0 additions & 42 deletions benchmark/single-source/PartialApplyDynamicType.swift

This file was deleted.

2 changes: 0 additions & 2 deletions benchmark/utils/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ import ObserverPartiallyAppliedMethod
import ObserverUnappliedMethod
import OpaqueConsumingUsers
import OpenClose
import PartialApplyDynamicType
import Phonebook
import PointerArithmetics
import PolymorphicCalls
Expand Down Expand Up @@ -267,7 +266,6 @@ registerBenchmark(ObserverPartiallyAppliedMethod)
registerBenchmark(ObserverUnappliedMethod)
registerBenchmark(OpaqueConsumingUsers)
registerBenchmark(OpenClose)
registerBenchmark(PartialApplyDynamicType)
registerBenchmark(Phonebook)
registerBenchmark(PointerArithmetics)
registerBenchmark(PolymorphicCalls)
Expand Down
29 changes: 29 additions & 0 deletions test/SILOptimizer/partial_apply_dynamic_type.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// RUN: %target-swift-frontend -O -emit-ir %s

// Test that this does not crash

protocol P {
func f(_ i: Int) -> Int
}

func g<T: P>(_ t: T) -> ((T) -> (Int) -> Int) {
let f = { type(of: t).f($0) }
return f
}

class C: P {
func f(_ i: Int) -> Int {
return i + 1
}
}

let c = C()

public func test_PartialApplyDynamicType() -> Int {
var result = 0
for _ in 1...100000 {
result += g(c)(c)(1)
}
return result
}