@@ -36,6 +36,9 @@ pub struct Baz {
36
36
// CHECK-LABEL: @vec_iterator_cast_primitive
37
37
#[ no_mangle]
38
38
pub fn vec_iterator_cast_primitive ( vec : Vec < i8 > ) -> Vec < u8 > {
39
+ // CHECK-NOT: loop
40
+ // CHECK: call
41
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
39
42
// CHECK-NOT: loop
40
43
// CHECK-NOT: call
41
44
vec. into_iter ( ) . map ( |e| e as u8 ) . collect ( )
@@ -44,14 +47,37 @@ pub fn vec_iterator_cast_primitive(vec: Vec<i8>) -> Vec<u8> {
44
47
// CHECK-LABEL: @vec_iterator_cast_wrapper
45
48
#[ no_mangle]
46
49
pub fn vec_iterator_cast_wrapper ( vec : Vec < u8 > ) -> Vec < Wrapper < u8 > > {
50
+ // CHECK-NOT: loop
51
+ // CHECK: call
52
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
47
53
// CHECK-NOT: loop
48
54
// CHECK-NOT: call
49
55
vec. into_iter ( ) . map ( |e| Wrapper ( e) ) . collect ( )
50
56
}
51
57
58
+ // CHECK-LABEL: @vec_iterator_cast_signed
59
+ #[ no_mangle]
60
+ pub fn vec_iterator_cast_signed ( vec : Vec < i32 > ) -> Vec < u32 > {
61
+ // CHECK-NOT: and i{{[0-9]+}} %{{.*}}, {{[0-9]+}}
62
+ vec. into_iter ( ) . map ( |e| u32:: from_ne_bytes ( e. to_ne_bytes ( ) ) ) . collect ( )
63
+ }
64
+
65
+ // CHECK-LABEL: @vec_iterator_cast_signed_nested
66
+ #[ no_mangle]
67
+ pub fn vec_iterator_cast_signed_nested ( vec : Vec < Vec < i32 > > ) -> Vec < Vec < u32 > > {
68
+ // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
69
+ // CHECK-NOT: %{{.*}} = udiv
70
+ vec. into_iter ( )
71
+ . map ( |e| e. into_iter ( ) . map ( |e| u32:: from_ne_bytes ( e. to_ne_bytes ( ) ) ) . collect ( ) )
72
+ . collect ( )
73
+ }
74
+
52
75
// CHECK-LABEL: @vec_iterator_cast_unwrap
53
76
#[ no_mangle]
54
77
pub fn vec_iterator_cast_unwrap ( vec : Vec < Wrapper < u8 > > ) -> Vec < u8 > {
78
+ // CHECK-NOT: loop
79
+ // CHECK: call
80
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
55
81
// CHECK-NOT: loop
56
82
// CHECK-NOT: call
57
83
vec. into_iter ( ) . map ( |e| e. 0 ) . collect ( )
@@ -60,6 +86,9 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
60
86
// CHECK-LABEL: @vec_iterator_cast_aggregate
61
87
#[ no_mangle]
62
88
pub fn vec_iterator_cast_aggregate ( vec : Vec < [ u64 ; 4 ] > ) -> Vec < Foo > {
89
+ // CHECK-NOT: loop
90
+ // CHECK: call
91
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
63
92
// CHECK-NOT: loop
64
93
// CHECK-NOT: call
65
94
vec. into_iter ( ) . map ( |e| unsafe { std:: mem:: transmute ( e) } ) . collect ( )
@@ -68,6 +97,9 @@ pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> {
68
97
// CHECK-LABEL: @vec_iterator_cast_deaggregate_tra
69
98
#[ no_mangle]
70
99
pub fn vec_iterator_cast_deaggregate_tra ( vec : Vec < Bar > ) -> Vec < [ u64 ; 4 ] > {
100
+ // CHECK-NOT: loop
101
+ // CHECK: call
102
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
71
103
// CHECK-NOT: loop
72
104
// CHECK-NOT: call
73
105
@@ -81,6 +113,9 @@ pub fn vec_iterator_cast_deaggregate_tra(vec: Vec<Bar>) -> Vec<[u64; 4]> {
81
113
// CHECK-LABEL: @vec_iterator_cast_deaggregate_fold
82
114
#[ no_mangle]
83
115
pub fn vec_iterator_cast_deaggregate_fold ( vec : Vec < Baz > ) -> Vec < [ u64 ; 4 ] > {
116
+ // CHECK-NOT: loop
117
+ // CHECK: call
118
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
84
119
// CHECK-NOT: loop
85
120
// CHECK-NOT: call
86
121
@@ -94,6 +129,11 @@ pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> {
94
129
// CHECK-LABEL: @vec_iterator_cast_unwrap_drop
95
130
#[ no_mangle]
96
131
pub fn vec_iterator_cast_unwrap_drop ( vec : Vec < Wrapper < String > > ) -> Vec < String > {
132
+ // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
133
+ // CHECK-NOT: %{{.*}} = mul
134
+ // CHECK-NOT: %{{.*}} = udiv
135
+ // CHECK: call
136
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
97
137
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
98
138
// CHECK-NOT: call
99
139
// CHECK-NOT: %{{.*}} = mul
@@ -105,10 +145,16 @@ pub fn vec_iterator_cast_unwrap_drop(vec: Vec<Wrapper<String>>) -> Vec<String> {
105
145
// CHECK-LABEL: @vec_iterator_cast_wrap_drop
106
146
#[ no_mangle]
107
147
pub fn vec_iterator_cast_wrap_drop ( vec : Vec < String > ) -> Vec < Wrapper < String > > {
148
+ // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
149
+ // CHECK-NOT: %{{.*}} = mul
150
+ // CHECK-NOT: %{{.*}} = udiv
151
+ // CHECK: call
152
+ // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
108
153
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
109
154
// CHECK-NOT: call
110
155
// CHECK-NOT: %{{.*}} = mul
111
156
// CHECK-NOT: %{{.*}} = udiv
157
+ // CHECK: ret void
112
158
113
159
vec. into_iter ( ) . map ( Wrapper ) . collect ( )
114
160
}
0 commit comments