Skip to content

Commit 9617af5

Browse files
committed
Remove the flag -disable-func-sig-opts from a bunch of tests.
This commit removes the flag '-disable-func-sig-opts' from a bunch of tests and fixes all of the affected tests. This flag was introduces when the function-signature-opt optimization was introduced and we did not port the old tests. Now the day has come to clean all of the old tests and delete the flag.
1 parent b87ca95 commit 9617af5

9 files changed

+119
-153
lines changed

test/Frontend/OptimizationOptions-with-stdlib-checks.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
2-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
3-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
4-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
1+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
2+
// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
3+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
4+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
55

66
// REQUIRES: optimized_stdlib
77
// REQUIRES: swift_stdlib_asserts

test/Frontend/OptimizationOptions-without-stdlib-checks.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
2-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
3-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
4-
// RUN: %target-swift-frontend -module-name OptimizationOptions -disable-func-sig-opts -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
1+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
2+
// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
3+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
4+
// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
55

66
// REQUIRES: optimized_stdlib
77
// REQUIRES: swift_stdlib_asserts

test/SIL/Serialization/function_param_convention.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir -p %t
3-
// RUN: %target-swift-frontend -parse-sil -disable-func-sig-opts -sil-inline-threshold 0 %S/Inputs/function_param_convention_input.sil -o %t/FunctionInput.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-name FunctionInput -sil-serialize-all -O
3+
// RUN: %target-swift-frontend -parse-sil -sil-inline-threshold 0 %S/Inputs/function_param_convention_input.sil -o %t/FunctionInput.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-name FunctionInput -sil-serialize-all -O
44
// RUN: %target-sil-opt -I %t -linker %s -o - | FileCheck %s
55

66
import Swift

test/SIL/Serialization/shared_function_serialization.sil

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir -p %t
3-
// RUN: %target-swift-frontend -disable-func-sig-opts %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all -O
3+
// RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all -O
44
// RUN: %target-sil-opt -enable-sil-verify-all -I %t -linker -inline %s -o - | FileCheck %s
55

6-
// CHECK: sil private @top_level_code : $@convention(thin) () -> () {
7-
// CHECK: sil public_external [fragile] @_TFVs1XCfT_S_ : $@convention(thin) (@thin X.Type) -> X {
8-
// CHECK: sil public_external [fragile] @_TFs17the_thing_it_doesFT1xVs1X_T_ : $@convention(thin) (X) -> () {
9-
// CHECK: sil shared_external [fragile] [noinline] @_TTSg5Vs1X___TFs9the_thingurFT1tx_T_ : $@convention(thin) (@in X) -> () {
6+
// CHECK: sil private @top_level_code
7+
// CHECK: sil public_external [fragile] @{{.*}}_TFVs1XCfT_S_
8+
// CHECK: sil public_external [fragile] @{{.*}}_TFs17the_thing_it_doesFT1xVs1X_T_
9+
// CHECK: sil shared_external [fragile] [noinline] @{{.*}}_TTSg5Vs1X___TFs9the_thingurFT1tx_T_
1010

1111
sil_stage canonical
1212

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir -p %t
3-
// RUN: %target-swift-frontend -emit-module %S/Inputs/specializer_input.swift -O -sil-serialize-all -parse-stdlib -parse-as-library -emit-module -o %t/Swift.swiftmodule -module-name=Swift -module-link-name swiftCore -disable-func-sig-opts
4-
// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - -disable-func-sig-opts | FileCheck %s
3+
// RUN: %target-swift-frontend -emit-module %S/Inputs/specializer_input.swift -O -sil-serialize-all -parse-stdlib -parse-as-library -emit-module -o %t/Swift.swiftmodule -module-name=Swift -module-link-name swiftCore
4+
// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - | FileCheck %s
55

66
import Swift
77

88
// Make sure the specializer can deserialize code.
99

1010
// CHECK-LABEL: sil @main
1111
// CHECK: bb0({{.*}}):
12-
// CHECK: function_ref @_TTSg5Bi32____TFVs9ContainerCfT_GS_x_
13-
// CHECK: function_ref @_TTSg5Bi32____TFVs9Container11doSomethingfT_T_ : $@convention(method) (Container<Builtin.Int32>) -> ()
12+
// CHECK: function_ref @{{.*}}_TTSg5Bi32____TFVs9ContainerCfT_GS_x_
13+
// CHECK: function_ref @{{.*}}_TTSg5Bi32____TFVs9Container11doSomethingfT_T_
1414

15-
// CHECK-LABEL: sil shared [fragile] [noinline] @_TTSg5Bi32____TFVs9ContainerCfT_GS_x_ : $@convention(thin) (@thin Container<Builtin.Int32>.Type) -> Container<Builtin.Int32> {
15+
// CHECK-LABEL: sil shared [fragile] [noinline] @_TTSf4d___TTSg5Bi32____TFVs9ContainerCfT_GS_x_
1616

17-
// CHECK-LABEL: sil shared [fragile] [noinline] @_TTSg5Bi32____TFVs9Container11doSomethingfT_T_ : $@convention(method) (Container<Builtin.Int32>) -> () {
17+
// CHECK-LABEL: sil shared [fragile] [noinline] @_TTSf4d___TTSg5Bi32____TFVs9Container11doSomethingfT_T_
1818

1919
var c = Container<Int>()
2020
c.doSomething()

test/SILPasses/devirt_base_class.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -O -emit-sil -disable-func-sig-opts %s | FileCheck %s
1+
// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
22

33
public class Base1 { @inline(never) func f() -> Int { return 0 } }
44

@@ -17,15 +17,25 @@ private class C : A {
1717

1818
@inline(never)
1919
private func foo(a: A) -> Int {
20+
21+
22+
// Check that invocation of addConstraint() gets completely devirtualized and inlined
23+
//
24+
// CHECK-LABEL: sil private [noinline] @_TFC17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD2F24test
25+
// CHECK-NOT: class_method
26+
// CHECK-NOT: function_ref
27+
// CHECK: return
28+
2029
// Check that a.f() call can be devirtualized, even
2130
// though f is defined by one of the A's superclasses.
2231
//
23-
// CHECK-LABEL: sil private [noinline] @_TF17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD3fooFCS_P33_C1ED27807F941A622F32D66AB60A15CD1ASi
32+
33+
// CHECK-LABEL: sil private [noinline] @_TTSf4g___TF17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD3fooFCS_P33_C1ED27807F941A622F32D66AB60A15CD1ASi
2434
// CHECK-NOT: class_method
2535
// CHECK: checked_cast_br
26-
// CHECK: function_ref @_TFC17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD1B1f
36+
// CHECK: function_ref
2737
// CHECK: checked_cast_br
28-
// CHECK: function_ref @_TFC17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD1C1f
38+
// CHECK: function_ref
2939
return a.f()
3040
}
3141

@@ -54,12 +64,6 @@ private class F2 : F1 {
5464

5565
@inline(never)
5666
func test() {
57-
// Check that invocation of addConstraint() gets completely devirtualized and inlined
58-
//
59-
// CHECK-LABEL: sil private [noinline] @_TFC17devirt_base_classP33_C1ED27807F941A622F32D66AB60A15CD2F24test
60-
// CHECK-NOT: class_method
61-
// CHECK-NOT: function_ref
62-
// CHECK: return
6367
addConstraint()
6468
}
6569

test/SILPasses/devirt_default_case.swift

Lines changed: 24 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -O -module-name devirt_default_case -disable-func-sig-opts -emit-sil %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
2-
// RUN: %target-swift-frontend -O -module-name devirt_default_case -disable-func-sig-opts -emit-sil -enable-testing %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
1+
// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
2+
// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil -enable-testing %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
33

44
@_silgen_name("action")
55
func action(n:Int)->()
@@ -41,8 +41,8 @@ private class Derived2 : Base2 {
4141
// Check that call to Base2.middle can be devirtualized
4242
//
4343
// CHECK-LABEL: sil @_TF19devirt_default_case9callOuterFSiSi
44-
// CHECK: function_ref @_TFC19devirt_default_caseP33_77424841540E67CC820F5E5F7940DCB05Base25inner
45-
// CHECK: function_ref @_TFC19devirt_default_caseP33_77424841540E67CC820F5E5F7940DCB08Derived26middle
44+
// CHECK: function_ref @{{.*}}TFC19devirt_default_caseP33_77424841540E67CC820F5E5F7940DCB05Base25inner
45+
// CHECK: function_ref @{{.*}}TFC19devirt_default_caseP33_77424841540E67CC820F5E5F7940DCB08Derived26middle
4646
// CHECK-NOT: class_method
4747
// CHECK: return
4848
public func callOuter(x: Int) -> Int {
@@ -67,8 +67,8 @@ class Base3 {
6767
// for testing.
6868
//
6969
// CHECK-LABEL: sil{{( hidden)?}} [noinline] @_TFC19devirt_default_case5Base35outer
70-
// CHECK: function_ref @_TFC19devirt_default_case5Base36middle
71-
// CHECK: function_ref @_TFC19devirt_default_caseP{{.*}}8Derived36middle
70+
// CHECK: function_ref @{{.*}}TFC19devirt_default_case5Base36middle
71+
// CHECK: function_ref @{{.*}}TFC19devirt_default_caseP{{.*}}8Derived36middle
7272
// CHECK-NORMAL-NOT: class_method
7373
// CHECK-TESTABLE: class_method %0 : $Base3, #Base3.middle!1
7474
// CHECK: }
@@ -91,17 +91,6 @@ class C2 : A2 {}
9191
class D2: B2 {}
9292
class E2 :C2 {}
9393

94-
@inline(never)
95-
func foo(a: A2) -> Int {
96-
// Check that call to A2.f() can be devirualized.
97-
//
98-
// CHECK-LABEL: sil{{( hidden)?}} [noinline] @_TF19devirt_default_case3fooFCS_2A2Si
99-
// CHECK: function_ref @_TFC19devirt_default_case2A21f
100-
// CHECK-NORMAL-NOT: class_method
101-
// CHECK-TESTABLE: class_method %0 : $A2, #A2.f!1
102-
// CHECK: }
103-
return a.f()
104-
}
10594

10695
public func testfoo1() -> Int {
10796
return foo(E2())
@@ -120,8 +109,8 @@ func foo(a: A3) -> Int {
120109
// Check that call to A3.f() can be devirualized.
121110
//
122111
// CHECK-LABEL: sil{{( hidden)?}} [noinline] @_TF19devirt_default_case3fooFCS_2A3Si
123-
// CHECK: function_ref @_TFC19devirt_default_case2B31f
124-
// CHECK: function_ref @_TFC19devirt_default_case2A31f
112+
// CHECK: function_ref @{{.*}}TFC19devirt_default_case2B31f
113+
// CHECK: function_ref @{{.*}}TFC19devirt_default_case2A31f
125114
// CHECK-NORMAL-NOT: class_method
126115
// CHECK-TESTABLE: class_method %0 : $A3, #A3.f!1
127116
// CHECK: }
@@ -138,8 +127,8 @@ class Base4 {
138127
// Check that call to foo() can be devirtualized
139128
//
140129
// CHECK-LABEL: sil{{( hidden)?}} [noinline] @_TFC19devirt_default_case5Base44test
141-
// CHECK: function_ref @_TFC19devirt_default_case5Base43foo
142-
// CHECK: function_ref @_TFC19devirt_default_case8Derived43foo
130+
// CHECK: function_ref @{{.*}}TFC19devirt_default_case5Base43foo
131+
// CHECK: function_ref @{{.*}}TFC19devirt_default_case8Derived43foo
143132
// CHECK-NORMAL-NOT: class_method
144133
// CHECK-TESTABLE: class_method %0 : $Base4, #Base4.foo!1
145134
// CHECK: }
@@ -156,13 +145,6 @@ class Derived4 : Base4 {
156145
public class Base5 {
157146
@inline(never)
158147
public func test() {
159-
// Check that call to foo() does not use class_method, because
160-
// it is a final method.
161-
//
162-
// CHECK-LABEL: sil [noinline] @_TFC19devirt_default_case5Base54test
163-
// CHECK: function_ref @_TFC19devirt_default_case5Base53foo
164-
// CHECK-NOT: class_method
165-
// CHECK: }
166148
foo()
167149
}
168150

@@ -200,28 +182,6 @@ public func test_check_static_class_devirt() -> Int {
200182
class A7 { @inline(never) func foo() -> Bool { return false } }
201183
class B7 : A7 { @inline(never) override func foo() -> Bool { return true } }
202184

203-
// Check that it compiles without crashes and devirtualizes
204-
// calls to A7.foo and B7.foo
205-
//
206-
// CHECK-LABEL: sil{{( hidden)?}} [noinline] @_TF19devirt_default_case33check_call_on_downcasted_instanceFCS_2A7Sb
207-
// CHECK: checked_cast_br
208-
// CHECK-NOT: class_method
209-
// CHECK: unconditional_checked_cast
210-
// CHECK: function_ref @_TFC19devirt_default_case2B73foo
211-
// CHECK-NORMAL-NOT: class_method
212-
// CHECK-TESTABLE: class_method %{{[0-9]+}} : $B7, #B7.foo!1
213-
// CHECK: function_ref @_TFC19devirt_default_case2A73foo
214-
// CHECK-NORMAL-NOT: class_method
215-
// CHECK-TESTABLE: class_method %{{[0-9]+}} : $A7, #A7.foo!1
216-
// CHECK: return
217-
@inline(never)
218-
func check_call_on_downcasted_instance(a: A7) -> Bool {
219-
if a is B7 {
220-
return (a as! B7).foo()
221-
}
222-
return a.foo()
223-
}
224-
225185
public func test_check_call_on_downcasted_instance() -> Bool {
226186
return check_call_on_downcasted_instance(B7())
227187
}
@@ -292,30 +252,21 @@ internal class M33: M3 {
292252
// The alternatives should be taken in a breadth-first order, starting with
293253
// the static type of the instance.
294254

295-
// CHECK: sil [noinline] @_TF19devirt_default_case54testSpeculativeDevirtualizationWithTooManyAlternativesFCS_2M1Vs5Int32
296-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M1
297-
// CHECK: function_ref @_TFC19devirt_default_case2M13foo
298-
// CHECK: br bb1
299-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M2
300-
// CHECK: function_ref @_TFC19devirt_default_case2M23foo
301-
// CHECK: br bb1
302-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M3
303-
// CHECK: function_ref @_TFC19devirt_default_case2M33foo
304-
// CHECK: br bb1
305-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M22
306-
// CHECK: function_ref @_TFC19devirt_default_case3M223foo
307-
// CHECK: br bb1
308-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M33
309-
// CHECK: function_ref @_TFC19devirt_default_case3M333foo
310-
// CHECK: br bb1
311-
// CHECK: checked_cast_br [exact] %0 : $M1 to $M222
312-
// CHECK: function_ref @_TFC19devirt_default_case4M2223foo
313-
// CHECK: br bb1
314-
// CHECK-NOT: checked_cast_br
315-
// CHECK: class_method
316-
// CHECK: apply
317-
// CHECK: br bb1
318255
@inline(never)
319256
public func testSpeculativeDevirtualizationWithTooManyAlternatives(c:M1) -> Int32{
320257
return c.foo()
321258
}
259+
260+
261+
@inline(never)
262+
func foo(a: A2) -> Int {
263+
return a.f()
264+
}
265+
266+
@inline(never)
267+
func check_call_on_downcasted_instance(a: A7) -> Bool {
268+
if a is B7 {
269+
return (a as! B7).foo()
270+
}
271+
return a.foo()
272+
}

test/SILPasses/specialize_apply_conf.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-func-sig-opts -O -sil-inline-threshold 1 -emit-sil -primary-file %s | FileCheck %s
1+
// RUN: %target-swift-frontend -O -sil-inline-threshold 1 -emit-sil -primary-file %s | FileCheck %s
22

33
// We can't deserialize apply_inst with subst lists. When radar://14443304
44
// is fixed then we should convert this test to a SIL test.
@@ -19,7 +19,7 @@ func main_func<T>(In In : T) {
1919
}
2020

2121
//CHECK: sil hidden @_TF21specialize_apply_conf11interestingFT_T_
22-
//CHECK: function_ref @_TTSg5Si___TF21specialize_apply_conf9main_func
22+
//CHECK: function_ref @_TTSf4d___TTSg5Si___TF21specialize_apply_conf9main_funcurFT2Inx_T_
2323
//CHECK-NEXT: apply
2424
//CHECK: return
2525
func interesting() {

0 commit comments

Comments
 (0)