1
- // RUN: %target-sil-opt -enable-sil-verify-all %s -module-name Swift -redundant-load-elim
2
- // FIXME: This test is not FileCheck'd
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -module-name Swift -redundant-load-elim | FileCheck -check-prefix=CHECK-FUTURE %s
2
+ //
3
+ // FIXME: Contains tests which are handled by old RLE, but not current one. Mostly due to casting. Eventually we probably should
4
+ // handle these cases if they turn out to be important.
5
+ //
6
+ // The problem is the current RLE uses type projection tree/path to model fields in an object. This makes it difficult for it to
7
+ // reason about casts, i.e. 1 memory with different types.
8
+ //
9
+ // Tracked by rdar://23023366
3
10
4
11
import Builtin
5
12
@@ -59,7 +66,7 @@ struct Wrapper {
59
66
var value : Builtin.Int32
60
67
}
61
68
62
- // CHECK-LABEL : sil @tbaa_class_alias_nonclass
69
+ // CHECK-FUTURE : sil @tbaa_class_alias_nonclass
63
70
// CHECK: strong_retain [[RET:%[0-9]+]]
64
71
// CHECK: strong_retain [[RET]]
65
72
// CHECK: return
@@ -79,7 +86,7 @@ bb0(%0 : $B, %1 : $*Agg1):
79
86
}
80
87
81
88
// FIXME: When RLE uses TBAA it should remove the second load.
82
- // CHECK-LABEL : sil @tbaa_struct
89
+ // CHECK-FUTURE : sil @tbaa_struct
83
90
// CHECK: load
84
91
// CHECK: store
85
92
// CHECK: load
@@ -96,7 +103,7 @@ bb0(%0 : $Builtin.RawPointer, %1 : $A2):
96
103
}
97
104
98
105
// Even with TBAA, RLE should not remove the second load.
99
- // CHECK-LABEL : sil @tbaa_bind_memory
106
+ // CHECK-FUTURE : sil @tbaa_bind_memory
100
107
// CHECK: load
101
108
// CHECK: bind_memory
102
109
// CHECK: store
@@ -118,7 +125,7 @@ bb0(%0 : $Builtin.RawPointer, %1 : $A2):
118
125
}
119
126
120
127
// *NOTE* This does not handle raw pointer since raw pointer is only layout compatible with heap references.
121
- // CHECK-LABEL : sil @store_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (Optional<A>) -> () {
128
+ // CHECK-FUTURE : sil @store_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (Optional<A>) -> () {
122
129
// CHECK: bb0([[INPUT:%[0-9]+]]
123
130
// CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
124
131
// CHECK: unchecked_trivial_bit_cast [[INPUT]] : $Optional<A> to $Builtin.Int32
@@ -161,7 +168,7 @@ struct IntPtr {
161
168
// source type is known to be greater or equal to the size of the
162
169
// destination type.
163
170
//
164
- // CHECK-LABEL : sil @store_to_load_forward_unchecked_addr_cast_nopromote : $@convention(thin) (@inout IntPtr) -> () {
171
+ // CHECK-FUTURE : sil @store_to_load_forward_unchecked_addr_cast_nopromote : $@convention(thin) (@inout IntPtr) -> () {
165
172
// CHECK: bb0([[INPUT:%[0-9]+]] : $*IntPtr)
166
173
// CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
167
174
// CHECK: [[CAST:%[0-9]+]] = unchecked_addr_cast [[INPUT]] : $*IntPtr to $*Builtin.Int32
@@ -185,7 +192,7 @@ bb0(%0 : $*IntPtr):
185
192
// compatible with heap references, but does not have reference
186
193
// semantics b/c it is a trivial type. We currently do not handle such a case.
187
194
188
- // CHECK-LABEL : sil @store_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (Optional<B>) -> () {
195
+ // CHECK-FUTURE : sil @store_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (Optional<B>) -> () {
189
196
// CHECK: bb0([[INPUT:%[0-9]+]]
190
197
// CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
191
198
// CHECK: unchecked_trivial_bit_cast [[INPUT]] : $Optional<B> to $Builtin.Int32
@@ -221,7 +228,7 @@ bb0(%0 : $Optional<B>):
221
228
}
222
229
223
230
// *NOTE* This does not handle raw pointer since raw pointer is only layout compatible with heap references.
224
- // CHECK-LABEL : sil @load_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (@inout Optional<A>) -> () {
231
+ // CHECK-FUTURE : sil @load_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (@inout Optional<A>) -> () {
225
232
// CHECK: bb0(
226
233
227
234
// CHECK: unchecked_trivial_bit_cast {{%[0-9]+}} : $Optional<A> to $Builtin.Int32
@@ -256,7 +263,7 @@ bb0(%0 : $*Optional<A>):
256
263
// compatible with heap references, but does not have reference
257
264
// semantics b/c it is a trivial type. We currently do not handle such a case.
258
265
259
- // CHECK-LABEL : sil @load_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (@inout Optional<B>) -> () {
266
+ // CHECK-FUTURE : sil @load_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (@inout Optional<B>) -> () {
260
267
// CHECK: bb0({{%[0-9]+}} : $*Optional<B>):
261
268
// CHECK: unchecked_trivial_bit_cast {{%[0-9]+}} : $Optional<B> to $Builtin.Int32
262
269
// CHECK: unchecked_ref_bit_cast {{%[0-9]+}} : $Optional<B> to $B
@@ -287,7 +294,7 @@ bb0(%0 : $*Optional<B>):
287
294
}
288
295
289
296
// Don't bitcast differently sized structs.
290
- // CHECK-LABEL : sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct
297
+ // CHECK-FUTURE : sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct
291
298
// CHECK-NOT: unchecked_trivial_bit_cast
292
299
// CHECK: return
293
300
sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct : $@convention(thin) (C) -> () {
@@ -303,7 +310,7 @@ bb0(%0 : $C):
303
310
304
311
305
312
/// Make sure that we don't crash and don't optimize here.
306
- // CHECK-LABEL : sil @covering_store_with_unchecked_addr : $@convention(thin) (C, C) -> () {
313
+ // CHECK-FUTURE : sil @covering_store_with_unchecked_addr : $@convention(thin) (C, C) -> () {
307
314
// CHECK-NOT: unchecked_trivial_bit_cast
308
315
// CHECK: unchecked_addr_cast
309
316
// CHECK-NOT: unchecked_trivial_bit_cast
338
345
/// 4. %5 can write to memory, so we try to check if it can alias %0#1. We look
339
346
/// up the load that was erased and will use it in a memory unsafe way.
340
347
//
341
- // CHECK-LABEL : sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
348
+ // CHECK-FUTURE : sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
342
349
// CHECK-NOT: load
343
350
// CHECK-NOT: {{%.*}} = store
344
351
sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
@@ -361,7 +368,7 @@ sil @mutator : $@convention(method) (@inout HoldsRef) -> ()
361
368
362
369
// Ensure we don't forward the stored value from the switch_enum
363
370
// branches past the inout appearance of the stored-to location.
364
- // CHECK-LABEL : sil @bad_store_forward
371
+ // CHECK-FUTURE : sil @bad_store_forward
365
372
sil @bad_store_forward : $@convention(thin) (@guaranteed Optional<HoldsRef>) -> () {
366
373
// CHECK: bb0
367
374
bb0(%0 : $Optional<HoldsRef>):
409
416
// We internally use a map vector to represent stores. This means that when we iterate over
410
417
// the stores it should be in insertion order. Use this to test whether or not we only set
411
418
// the no-dependency bit if we do not forward a load.
412
- // CHECK-LABEL : sil @test_unchecked_addr_cast_3
419
+ // CHECK-FUTURE : sil @test_unchecked_addr_cast_3
413
420
// CHECK: bb0([[ARG1:%.*]] : $D, [[ARG2:%.*]] : $D):
414
421
// CHECK-NEXT: [[BOX1:%.*]] = alloc_stack $D
415
422
// CHECK-NEXT: [[BOX2:%.*]] = alloc_stack $D
@@ -441,7 +448,7 @@ typealias I32 = Builtin.Int32
441
448
// ((A, B), C) -> (A, B) is safe
442
449
// ((A, B), C) -> (A, B, C) is NOT safe
443
450
//
444
- // CHECK-LABEL : sil @unchecked_addr_cast_tuple_promote
451
+ // CHECK-FUTURE : sil @unchecked_addr_cast_tuple_promote
445
452
// CHECK: bb0(%0 : $*(Builtin.Int32, Builtin.Int32, Builtin.Int32), %1 : $*((Builtin.Int32, Builtin.Int32), Builtin.Int32)):
446
453
// CHECK: load %0 : $*(Builtin.Int32, Builtin.Int32, Builtin.Int32)
447
454
// CHECK: alloc_stack $(Builtin.Int32, Builtin.Int32, Builtin.Int32)
@@ -512,7 +519,7 @@ bb0(%0 : $*(I32, I32, I32), %1 : $*((I32, I32), I32)):
512
519
// ((A, B), C) -> (A, B) is safe
513
520
// ((A, B), C) -> (A, B, C) is NOT safe
514
521
//
515
- // CHECK-LABEL : sil @forward_tuple_elements
522
+ // CHECK-FUTURE : sil @forward_tuple_elements
516
523
// CHECK: tuple_element_addr
517
524
// CHECK: tuple_element_addr
518
525
// CHECK: tuple_element_addr
0 commit comments