@@ -267,119 +267,6 @@ bb0(%0 : $*Optional<B>):
267
267
return %9999 : $()
268
268
}
269
269
270
-
271
- // CHECK-LABEL: sil @load_to_load_conflicting_branches_diamond : $@convention(thin) (@inout Builtin.Int32) -> () {
272
- // CHECK: bb0(
273
- // CHECK: load
274
- // CHECK: bb1:
275
- // CHECK-NOT: load
276
- // CHECK: store
277
- // CHECK-NOT: load
278
- // CHECK: bb2:
279
- // CHECK: bb3:
280
- // CHECK: load
281
- sil @load_to_load_conflicting_branches_diamond : $@convention(thin) (@inout Builtin.Int32) -> () {
282
- bb0(%0 : $*Builtin.Int32):
283
- %1 = load %0 : $*Builtin.Int32
284
- builtin "trunc_Int32_Int1"(%1 : $Builtin.Int32) : $Builtin.Int1
285
- cond_br undef, bb1, bb2
286
-
287
- bb1:
288
- %3 = load %0 : $*Builtin.Int32
289
- %4 = integer_literal $Builtin.Int32, 2
290
- builtin "trunc_Int32_Int1"(%3 : $Builtin.Int32) : $Builtin.Int1
291
- store %4 to %0 : $*Builtin.Int32
292
- builtin "trunc_Int32_Int1"(%3 : $Builtin.Int32) : $Builtin.Int1
293
- %5 = load %0 : $*Builtin.Int32
294
- builtin "trunc_Int32_Int1"(%5 : $Builtin.Int32) : $Builtin.Int1
295
- br bb3
296
-
297
- bb2:
298
- %6 = load %0 : $*Builtin.Int32
299
- builtin "trunc_Int32_Int1"(%6 : $Builtin.Int32) : $Builtin.Int1
300
- br bb3
301
-
302
- bb3:
303
- %7 = load %0 : $*Builtin.Int32
304
- builtin "trunc_Int32_Int1"(%7 : $Builtin.Int32) : $Builtin.Int1
305
- %9999 = tuple()
306
- return %9999 : $()
307
- }
308
-
309
- // CHECK-LABEL: sil @load_to_load_irreducible_loop : $@convention(thin) (@inout Builtin.Int32) -> () {
310
- // CHECK: bb0(
311
- // CHECK: load
312
- // CHECK: bb1:
313
- // CHECK: load
314
- // CHECK: store
315
- // CHECK-NOT: load
316
- // CHECK: bb2:
317
- // CHECK: bb3:
318
- // CHECK: load
319
- sil @load_to_load_irreducible_loop : $@convention(thin) (@inout Builtin.Int32) -> () {
320
- bb0(%0 : $*Builtin.Int32):
321
- %1 = load %0 : $*Builtin.Int32
322
- builtin "trunc_Int32_Int1"(%1 : $Builtin.Int32) : $Builtin.Int1
323
- cond_br undef, bb1, bb2
324
-
325
- bb1:
326
- %3 = load %0 : $*Builtin.Int32
327
- %4 = integer_literal $Builtin.Int32, 2
328
- builtin "trunc_Int32_Int1"(%3 : $Builtin.Int32) : $Builtin.Int1
329
- store %4 to %0 : $*Builtin.Int32
330
- builtin "trunc_Int32_Int1"(%3 : $Builtin.Int32) : $Builtin.Int1
331
- %5 = load %0 : $*Builtin.Int32
332
- builtin "trunc_Int32_Int1"(%5 : $Builtin.Int32) : $Builtin.Int1
333
- cond_br undef, bb2, bb3
334
-
335
- bb2:
336
- %6 = load %0 : $*Builtin.Int32
337
- builtin "trunc_Int32_Int1"(%6 : $Builtin.Int32) : $Builtin.Int1
338
- cond_br undef, bb1, bb3
339
-
340
- bb3:
341
- %7 = load %0 : $*Builtin.Int32
342
- builtin "trunc_Int32_Int1"(%7 : $Builtin.Int32) : $Builtin.Int1
343
- %9999 = tuple()
344
- return %9999 : $()
345
- }
346
-
347
- // CHECK-LABEL: sil @load_to_load_loop : $@convention(thin) (@inout Builtin.Int32, @inout Builtin.Int32) -> () {
348
- // CHECK: bb0([[PTR0:%[0-9]+]] : $*Builtin.Int32, [[PTR1:%[0-9]+]] : $*Builtin.Int32):
349
- // CHECK: load [[PTR0]]
350
- // CHECK: bb1:
351
- // CHECK: load [[PTR0]]
352
- // CHECK: store {{%[0-9]+}} to [[PTR0]]
353
- // CHECK-NOT: load
354
- // CHECK: bb2:
355
- // CHECK: load [[PTR1]]
356
- sil @load_to_load_loop : $@convention(thin) (@inout Builtin.Int32, @inout Builtin.Int32) -> () {
357
- bb0(%0 : $*Builtin.Int32, %1 : $*Builtin.Int32):
358
- %2 = load %0 : $*Builtin.Int32
359
- %99 = load %1 : $*Builtin.Int32
360
- builtin "trunc_Int32_Int1"(%2 : $Builtin.Int32) : $Builtin.Int1
361
- br bb1
362
-
363
- bb1:
364
- %4 = load %0 : $*Builtin.Int32
365
- %5 = integer_literal $Builtin.Int32, 2
366
- builtin "trunc_Int32_Int1"(%4 : $Builtin.Int32) : $Builtin.Int1
367
- store %5 to %0 : $*Builtin.Int32
368
- builtin "trunc_Int32_Int1"(%4 : $Builtin.Int32) : $Builtin.Int1
369
- %6 = load %0 : $*Builtin.Int32
370
- builtin "trunc_Int32_Int1"(%6 : $Builtin.Int32) : $Builtin.Int1
371
- cond_br undef, bb1, bb2
372
-
373
- bb2:
374
- %7 = load %0 : $*Builtin.Int32
375
- builtin "trunc_Int32_Int1"(%7 : $Builtin.Int32) : $Builtin.Int1
376
- %8 = load %1 : $*Builtin.Int32
377
- builtin "trunc_Int32_Int1"(%8 : $Builtin.Int32) : $Builtin.Int1
378
- %9999 = tuple()
379
- return %9999 : $()
380
- }
381
-
382
-
383
270
// Don't bitcast differently sized structs.
384
271
// CHECK-LABEL: sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct
385
272
// CHECK-NOT: unchecked_trivial_bit_cast
@@ -665,88 +552,6 @@ bb2:
665
552
return %5 : $A
666
553
}
667
554
668
- // Forward store %1 and store %2 such that load %3 becomes an identity trivial cast.
669
- // Both loads from %0 will be eliminated.
670
- // CHECK-LABEL: sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
671
- // CHECK: bb0([[ARG_0:%.*]] : $*A, [[ARG_1:%.*]] : $A, {{%.*}} : $A):
672
- // CHECK: store
673
- // CHECK: br bb1([[ARG_1]] : $A)
674
- // CHECK: bb1([[PHI:%.*]] : $A):
675
- // CHECK-NEXT: unchecked_trivial_bit_cast
676
- // CHECK-NEXT: store
677
- // CHECK-NEXT: cond_br
678
- // CHECK: bb2:
679
- // CHECK: return [[PHI]] : $A
680
- sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
681
- bb0(%0 : $*A, %1 : $A, %2 : $A):
682
- store %1 to %0 : $*A
683
- %3 = unchecked_addr_cast %0 : $*A to $*A
684
- %4 = unchecked_addr_cast %3 : $*A to $*A
685
- br bb1
686
-
687
- bb1:
688
- // This means that the first store is not dead.
689
- %6 = load %3 : $*A
690
- // But we still should be able to forward this load.
691
- %7 = load %0 : $*A
692
- // This load must be forwarded is needed to trigger the self loop forwarding. Once we do the full
693
- // optimistic dataflow this will no longer be needed.
694
- %8 = load %0 : $*A
695
- store %2 to %0 : $*A
696
- cond_br undef, bb1, bb2
697
-
698
- bb2:
699
- return %7 : $A
700
- }
701
-
702
- // Check load forwarding across strong_release in case the stored memory does
703
- // not escape.
704
- // CHECK-LABEL: sil @test_store_forwarding_strong_release
705
- // CHECK: strong_release
706
- // CHECK-NOT: [[BOX0:%.*]] = load
707
- // CHECK: apply
708
- sil @test_store_forwarding_strong_release : $@convention(thin) (B, X) -> () {
709
- bb0(%0 : $B, %1 : $X):
710
- %2 = alloc_stack $A // users: %3, %13
711
- %3 = struct_element_addr %2#1 : $*A, #A.i // users: %5, %10
712
- %4 = integer_literal $Builtin.Int32, 32 // user: %5
713
- store %4 to %3 : $*Builtin.Int32 // id: %5
714
- %6 = ref_to_unowned %0 : $B to $@sil_unowned B // user: %7
715
- unowned_release %6 : $@sil_unowned B // id: %7
716
- strong_release %0 : $B // id: %8
717
- release_value %1 : $X // id: %9
718
- %10 = load %3 : $*Builtin.Int32 // user: %12
719
- // function_ref use
720
- %11 = function_ref @use : $@convention(thin) (Builtin.Int32) -> () // user: %12
721
- %12 = apply %11(%10) : $@convention(thin) (Builtin.Int32) -> ()
722
- dealloc_stack %2#0 : $*@local_storage A // id: %13
723
- %14 = tuple () // user: %15
724
- return %14 : $()
725
- }
726
-
727
- // Check load forwarding across strong_release in case the loaded memory does
728
- // not escape.
729
- // CHECK-LABEL: sil @test_load_forwarding_strong_release
730
- // CHECK: strong_release
731
- // CHECK-NOT: [[BOX0:%.*]] = load
732
- // CHECK: apply
733
- sil @test_load_forwarding_strong_release : $@convention(thin) (B, X) -> () {
734
- bb0(%0 : $B, %1 : $X):
735
- %2 = alloc_stack $A // users: %3, %12
736
- %3 = struct_element_addr %2#1 : $*A, #A.i // users: %4, %9
737
- %4 = load %3 : $*Builtin.Int32
738
- %5 = ref_to_unowned %0 : $B to $@sil_unowned B // user: %6
739
- unowned_release %5 : $@sil_unowned B // id: %6
740
- strong_release %0 : $B // id: %7
741
- release_value %1 : $X // id: %8
742
- %9 = load %3 : $*Builtin.Int32 // user: %11
743
- // function_ref use
744
- %10 = function_ref @use : $@convention(thin) (Builtin.Int32) -> () // user: %11
745
- %11 = apply %10(%9) : $@convention(thin) (Builtin.Int32) -> ()
746
- dealloc_stack %2#0 : $*@local_storage A // id: %12
747
- %13 = tuple () // user: %14
748
- return %13 : $() // id: %14
749
- }
750
555
751
556
typealias I32 = Builtin.Int32
752
557
0 commit comments