Skip to content

Commit add1ba3

Browse files
committed
Update SIL and LLVM check lines
1 parent ebdd368 commit add1ba3

File tree

1 file changed

+43
-27
lines changed

1 file changed

+43
-27
lines changed

test/SILOptimizer/mutable_span_bounds_check_tests.swift

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module-path %t/SpanExtras.swiftmodule %S/Inputs/SpanExtras.swift -enable-builtin-module -enable-experimental-feature LifetimeDependence -enable-experimental-feature AllowUnsafeAttribute -enable-experimental-feature Span -O
33
// RUN: %target-swift-frontend -I %t -O -emit-sil %s -enable-experimental-feature Span -disable-availability-checking | %FileCheck %s --check-prefix=CHECK-SIL
4-
// RUN: %target-swift-frontend -I %t -O -emit-ir %s -enable-experimental-feature Span -disable-availability-checking
4+
// RUN: %target-swift-frontend -I %t -O -emit-ir %s -enable-experimental-feature Span -disable-availability-checking | %FileCheck %s --check-prefix=CHECK-IR
55

66
// REQUIRES: swift_in_compiler
77
// REQUIRES: swift_feature_LifetimeDependence
@@ -18,11 +18,14 @@ import SpanExtras
1818
// LLVM leaves behind a lower bound check outside the loop, does not vectorize the loop
1919

2020
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B10_zero_inityy10SpanExtras07MutableH0VySiGzF :
21-
// CHECK: bb2:
22-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
23-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
24-
// CHECK: cond_br
21+
// CHECK-SIL: bb3({{.*}}):
22+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
23+
// CHECK-SIL: cond_br
2524
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B10_zero_inityy10SpanExtras07MutableH0VySiGzF'
25+
26+
// CHECK-IR: define {{.*}} void @"$s31mutable_span_bounds_check_tests0B10_zero_inityy10SpanExtras07MutableH0VySiGzF"
27+
// CHECK-IR: vector.body
28+
// CHECK-IR: store <{{.*}}> zeroinitializer,
2629
public func span_zero_init(_ output: inout MutableSpan<Int>) {
2730
for i in output.indices {
2831
output[i] = 0
@@ -34,11 +37,14 @@ public func span_zero_init(_ output: inout MutableSpan<Int>) {
3437
// LLVM leaves behind a lower bound check outside the loop, does not vectorize the loop or reduce to a memcopy
3538

3639
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B14_copy_elemwiseyy10SpanExtras07MutableH0VySiGz_s0H0VySiGtF :
37-
// CHECK: bb2:
38-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
39-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
40-
// CHECK: cond_br
40+
// CHECK-SIL: bb3({{.*}}):
41+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
42+
// CHECK-SIL: cond_br
4143
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B14_copy_elemwiseyy10SpanExtras07MutableH0VySiGz_s0H0VySiGtF'
44+
45+
// CHECK-IR: define {{.*}} void @"$s31mutable_span_bounds_check_tests0B14_copy_elemwiseyy10SpanExtras07MutableH0VySiGz_s0H0VySiGtF"
46+
// CHECK-IR: vector.body
47+
// CHECK-IR: store <{{.*}}>
4248
public func span_copy_elemwise(_ output: inout MutableSpan<Int>, _ input: Span<Int>) {
4349
precondition(output.count >= input.count)
4450
for i in input.indices {
@@ -50,11 +56,14 @@ public func span_copy_elemwise(_ output: inout MutableSpan<Int>, _ input: Span<I
5056
// SIL does not optimize this
5157

5258
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B16_append_elemwiseyy10SpanExtras06OutputH0VySiGz_s0H0VySiGtF :
53-
// CHECK: bb2:
54-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
55-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
56-
// CHECK: cond_br
59+
// CHECK-SIL: bb3({{.*}}):
60+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
61+
// CHECK-SIL: cond_br
5762
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B16_append_elemwiseyy10SpanExtras06OutputH0VySiGz_s0H0VySiGtF'
63+
64+
// CHECK-IR: define {{.*}} void @"$s31mutable_span_bounds_check_tests0B16_append_elemwiseyy10SpanExtras06OutputH0VySiGz_s0H0VySiGtF"
65+
// CHECK-IR: vector.body
66+
// CHECK-IR: store <{{.*}}>
5867
public func span_append_elemwise(_ output: inout OutputSpan<Int>, _ input: Span<Int>) {
5968
for i in input.indices {
6069
output.append(input[i])
@@ -65,11 +74,14 @@ public func span_append_elemwise(_ output: inout OutputSpan<Int>, _ input: Span<
6574
// SIL does not optimize this
6675

6776
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B12_sum_wo_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF :
68-
// CHECK: bb2:
69-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
70-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
71-
// CHECK: cond_br
77+
// CHECK-SIL: bb3({{.*}}):
78+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
79+
// CHECK-SIL: cond_br
7280
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B12_sum_wo_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF'
81+
82+
// CHECK-IR: define {{.*}} void @"$s31mutable_span_bounds_check_tests0B12_sum_wo_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF"
83+
// CHECK-IR: vector.body
84+
// CHECK-IR: store <{{.*}}>
7385
public func span_sum_wo_trap(_ output: inout MutableSpan<Int>, _ input1: Span<Int>, _ input2: Span<Int>) {
7486
precondition(input1.count == input2.count)
7587
precondition(output.count == input1.count)
@@ -79,11 +91,11 @@ public func span_sum_wo_trap(_ output: inout MutableSpan<Int>, _ input1: Span<In
7991
}
8092

8193
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B14_sum_with_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF :
82-
// CHECK: bb2:
83-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
84-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
85-
// CHECK: cond_br
94+
// CHECK-SIL: bb3({{.*}}):
95+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
96+
// CHECK-SIL: cond_br
8697
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B14_sum_with_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF'
98+
8799
public func span_sum_with_trap(_ output: inout MutableSpan<Int>, _ input1: Span<Int>, _ input2: Span<Int>) {
88100
precondition(input1.count == input2.count)
89101
precondition(output.count == input1.count)
@@ -93,9 +105,9 @@ public func span_sum_with_trap(_ output: inout MutableSpan<Int>, _ input1: Span<
93105
}
94106

95107
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B12_bubble_sortyy10SpanExtras07MutableH0VySiGzF :
96-
// CHECK: bb10:
97-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
98-
// CHECK: cond_br
108+
// CHECK-SIL: bb11({{.*}}):
109+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
110+
// CHECK-SIL: cond_br
99111
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B12_bubble_sortyy10SpanExtras07MutableH0VySiGzF'
100112
public func span_bubble_sort(_ span: inout MutableSpan<Int>) {
101113
if span.count <= 1 {
@@ -113,10 +125,14 @@ public func span_bubble_sort(_ span: inout MutableSpan<Int>) {
113125
}
114126

115127
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests6sortedySb10SpanExtras07MutableG0VySiGF :
116-
// CHECK: bb4:
117-
// CHECK: cond_fail {{.*}}, "Index out of bounds"
118-
// CHECK: cond_br
128+
// CHECK-SIL: bb4:
129+
// CHECK-SIL: cond_fail {{.*}}, "precondition failure"
130+
// CHECK-SIL: cond_br
119131
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests6sortedySb10SpanExtras07MutableG0VySiGF'
132+
133+
// CHECK-IR: define swiftcc noundef i1 @"$s31mutable_span_bounds_check_tests6sortedySb10SpanExtras07MutableG0VySiGF"
134+
// CHECK-IR-NOT: trap
135+
// CHECK-IR: }
120136
public func sorted(_ span: borrowing MutableSpan<Int>) -> Bool {
121137
if span.count <= 1 {
122138
return true

0 commit comments

Comments
 (0)