11
11
import SpanExtras
12
12
13
13
// Bounds check should be eliminated
14
- // SIL does not optimize this
14
+ // SIL removes lower bounds check from the loop
15
15
// LLVM leaves behind a lower bound check outside the loop, does not vectorize the loop
16
16
17
17
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B10_zero_inityy10SpanExtras07MutableH0VySiGzF :
18
- // CHECK: bb2:
19
- // CHECK: cond_fail {{.*}}, "Index out of bounds"
18
+ // CHECK: bb3:
20
19
// CHECK: cond_fail {{.*}}, "Index out of bounds"
20
+ // CHECK-NOT: cond_fail {{.*}}, "Index out of bounds"
21
21
// CHECK: cond_br
22
22
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B10_zero_inityy10SpanExtras07MutableH0VySiGzF'
23
23
public func span_zero_init( _ output: inout MutableSpan < Int > ) {
@@ -27,13 +27,13 @@ public func span_zero_init(_ output: inout MutableSpan<Int>) {
27
27
}
28
28
29
29
// Bounds check should be eliminated
30
- // SIL does not optimize this
30
+ // SIL removes lower bounds check from the loop
31
31
// LLVM leaves behind a lower bound check outside the loop, does not vectorize the loop or reduce to a memcopy
32
32
33
33
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B14_copy_elemwiseyy10SpanExtras07MutableH0VySiGz_s0H0VySiGtF :
34
- // CHECK: bb2:
35
- // CHECK: cond_fail {{.*}}, "Index out of bounds"
34
+ // CHECK: bb3:
36
35
// CHECK: cond_fail {{.*}}, "Index out of bounds"
36
+ // CHECK-NOT: cond_fail {{.*}}, "Index out of bounds"
37
37
// CHECK: cond_br
38
38
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B14_copy_elemwiseyy10SpanExtras07MutableH0VySiGz_s0H0VySiGtF'
39
39
public func span_copy_elemwise( _ output: inout MutableSpan < Int > , _ input: Span < Int > ) {
@@ -44,12 +44,12 @@ public func span_copy_elemwise(_ output: inout MutableSpan<Int>, _ input: Span<I
44
44
}
45
45
46
46
// Bounds check should be eliminated
47
- // SIL does not optimize this
47
+ // SIL removes lower bounds check from the loop
48
48
49
49
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B16_append_elemwiseyy10SpanExtras06OutputH0VySiGz_s0H0VySiGtF :
50
- // CHECK: bb2:
51
- // CHECK: cond_fail {{.*}}, "Index out of bounds"
50
+ // CHECK: bb3:
52
51
// CHECK: cond_fail {{.*}}, "Index out of bounds"
52
+ // CHECK-NOT: cond_fail {{.*}}, "Index out of bounds"
53
53
// CHECK: cond_br
54
54
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B16_append_elemwiseyy10SpanExtras06OutputH0VySiGz_s0H0VySiGtF'
55
55
public func span_append_elemwise( _ output: inout OutputSpan < Int > , _ input: Span < Int > ) {
@@ -59,12 +59,12 @@ public func span_append_elemwise(_ output: inout OutputSpan<Int>, _ input: Span<
59
59
}
60
60
61
61
// Bounds check should be eliminated
62
- // SIL does not optimize this
62
+ // SIL removes lower bounds check from the loop
63
63
64
64
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B12_sum_wo_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF :
65
- // CHECK: bb2:
66
- // CHECK: cond_fail {{.*}}, "Index out of bounds"
65
+ // CHECK: bb3:
67
66
// CHECK: cond_fail {{.*}}, "Index out of bounds"
67
+ // CHECK-NOT: cond_fail {{.*}}, "Index out of bounds"
68
68
// CHECK: cond_br
69
69
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B12_sum_wo_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF'
70
70
public func span_sum_wo_trap( _ output: inout MutableSpan < Int > , _ input1: Span < Int > , _ input2: Span < Int > ) {
@@ -76,9 +76,9 @@ public func span_sum_wo_trap(_ output: inout MutableSpan<Int>, _ input1: Span<In
76
76
}
77
77
78
78
// CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests0B14_sum_with_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF :
79
- // CHECK: bb2:
80
- // CHECK: cond_fail {{.*}}, "Index out of bounds"
79
+ // CHECK: bb3:
81
80
// CHECK: cond_fail {{.*}}, "Index out of bounds"
81
+ // CHECK-NOT: cond_fail {{.*}}, "Index out of bounds"
82
82
// CHECK: cond_br
83
83
// CHECK-SIL-LABEL: } // end sil function '$s31mutable_span_bounds_check_tests0B14_sum_with_trapyy10SpanExtras07MutableI0VySiGz_s0I0VySiGAItF'
84
84
public func span_sum_with_trap( _ output: inout MutableSpan < Int > , _ input1: Span < Int > , _ input2: Span < Int > ) {
0 commit comments