Skip to content

Commit 16bd756

Browse files
committed
tests: make some test more robust for optimizer changes.
This is in preparation for COW support. More optimizer tests require an optimized non-assert stdlib build.
1 parent 33c8e16 commit 16bd756

7 files changed

+14
-6
lines changed

test/Driver/opt-remark.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %target-swiftc_driver -O -Rpass=sil-inliner %s -o %t/throwaway 2>&1 | %FileCheck -check-prefix=REMARK_PASSED %s
44
// RUN: %target-swiftc_driver -O -Rpass-missed=sil-inliner %s -o %t/throwaway 2>&1 | %FileCheck -check-prefix=REMARK_MISSED %s
55

6+
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
7+
68
// DEFAULT-NOT: remark:
79

810
func big() {
@@ -39,11 +41,11 @@ func small() {
3941

4042
func foo() {
4143
// REMARK_MISSED-NOT: remark: {{.*}} inlined
42-
// REMARK_MISSED: opt-remark.swift:44:2: remark: Not profitable to inline function "throwaway.big()" (cost = {{.*}}, benefit = {{.*}})
44+
// REMARK_MISSED: opt-remark.swift:46:2: remark: Not profitable to inline function "throwaway.big()" (cost = {{.*}}, benefit = {{.*}})
4345
// REMARK_MISSED-NOT: remark: {{.*}} inlined
4446
big()
4547
// REMARK_PASSED-NOT: remark: Not profitable
46-
// REMARK_PASSED: opt-remark.swift:48:3: remark: "throwaway.small()" inlined into "throwaway.foo()" (cost = {{.*}}, benefit = {{.*}})
48+
// REMARK_PASSED: opt-remark.swift:50:3: remark: "throwaway.small()" inlined into "throwaway.foo()" (cost = {{.*}}, benefit = {{.*}})
4749
// REMARK_PASSED-NOT: remark: Not profitable
4850
small()
4951
}

test/IRGen/multithread_module.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// RUN: %target-codesign %t/a.out
1010
// RUN: %target-run %t/a.out | %FileCheck %s
1111
// REQUIRES: executable_test
12+
// REQUIRES: optimized_stdlib,swift_stdlib_no_asserts
1213

1314

1415
// Test compilation of a module in multi-threaded compilation.

test/IRGen/objc_protocol_extended_method_types.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
// REQUIRES: OS=macosx
77
// REQUIRES: objc_interop
8+
// TODO: fix test for unoptimized stdlib with asserts
9+
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
10+
811

912
import Foundation
1013

test/SILOptimizer/generic_specialization_loops_detection_with_loops.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-frontend -O -emit-sil -enforce-exclusivity=unchecked -Xllvm -sil-print-generic-specialization-loops -Xllvm -sil-print-generic-specialization-info %s 2>&1 | %FileCheck --check-prefix=CHECK %s
22

3+
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
4+
35
// Check that the generic specializer does not hang a compiler by
46
// creating and infinite loop of generic specializations.
57

test/SILOptimizer/hello-world.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t && mkdir -p %t/stats
22
// RUN: %target-swift-frontend -emit-sil -stats-output-dir %t/stats %s -o /dev/null
33
// RUN: %{python} %utils/process-stats-dir.py --evaluate 'NumSILGenFunctions < 10' %t/stats
4-
// RUN: %{python} %utils/process-stats-dir.py --evaluate 'NumSILOptFunctions < 10' %t/stats
4+
// RUN: %{python} %utils/process-stats-dir.py --evaluate 'NumSILOptFunctions < 20' %t/stats
55

66
print("Hello world")

test/SILOptimizer/licm_exclusivity.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: %target-swift-frontend -O -enforce-exclusivity=checked -emit-sil -Xllvm -debug-only=sil-licm -whole-module-optimization %s 2>&1 | %FileCheck %s --check-prefix=TESTLICMWMO
55
// RUN: %target-swift-frontend -O -enforce-exclusivity=checked -emit-sil -whole-module-optimization %s | %FileCheck %s --check-prefix=TESTSILWMO
66

7-
// REQUIRES: optimized_stdlib,asserts
7+
// REQUIRES: optimized_stdlib,asserts,swift_stdlib_no_asserts
88
// REQUIRES: PTRSIZE=64
99

1010
// TESTLICM-LABEL: Processing loops in {{.*}}run_ReversedArray{{.*}}

test/SILOptimizer/stack_promotion_array_literal.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
// CHECK-LABEL: sil @{{.*}}testit
88
// CHECK: alloc_ref [stack] [tail_elems
99

10-
public func testit(_ N: Int) {
10+
public func testit(_ N: Int, _ x: Int) {
1111
for _ in 0..<N {
1212
for _ in 0..<10 {
1313
var nums = [Int]()
1414
for _ in 0..<40_000 {
15-
nums += [1, 2, 3, 4, 5, 6, 7]
15+
nums += [1, 2, 3, 4, 5, 6, x]
1616
}
1717
}
1818
}

0 commit comments

Comments
 (0)