@@ -586,6 +586,45 @@ bb6:
586
586
return %12 : $()
587
587
}
588
588
589
+ // CHECK-LABEL: sil @dont_sink_store_with_nonmaterializable_load_projection
590
+ // CHECK: alloc_stack
591
+ // CHECK-NOT: store
592
+ // CHECK: bb1(%8 : $Builtin.Int64, %9 : $Builtin.Int64):
593
+ // CHECK: store
594
+ // CHECK: [[INDEXADDR:%.*]] = index_addr
595
+ // CHECK: load [[INDEXADDR]]
596
+ // CHECK: bb3:
597
+ // CHECK-NOT: store
598
+ // CHECK: dealloc_stack
599
+ // CHECK: } // end sil function 'dont_sink_store_with_nonmaterializable_load_projection'
600
+ sil @dont_sink_store_with_nonmaterializable_load_projection : $@convention(method) (InlineArray<3, Int>) -> () {
601
+ bb0(%0 : $InlineArray<3, Int>):
602
+ %1 = integer_literal $Builtin.Int64, 0
603
+ %2 = integer_literal $Builtin.Int64, 1
604
+ %3 = integer_literal $Builtin.Int1, -1
605
+ %4 = struct_extract %0, #InlineArray._storage
606
+ %5 = alloc_stack $Builtin.FixedArray<3, Int>
607
+ %6 = vector_base_addr %5
608
+ br bb1(%1, %1)
609
+
610
+ bb1(%8 : $Builtin.Int64, %9 : $Builtin.Int64):
611
+ %10 = builtin "sadd_with_overflow_Int64"(%8, %2, %3) : $(Builtin.Int64, Builtin.Int1)
612
+ %11 = tuple_extract %10, 0
613
+ store %4 to %5
614
+ %13 = builtin "truncOrBitCast_Int64_Word"(%9) : $Builtin.Word
615
+ %14 = index_addr [stack_protection] %6, %13
616
+ %15 = load %14
617
+ cond_br undef, bb2, bb3
618
+
619
+ bb2:
620
+ br bb1(%1, %1)
621
+
622
+ bb3:
623
+ dealloc_stack %5
624
+ %18 = tuple ()
625
+ return %18
626
+ }
627
+
589
628
// CHECK-LABEL: sil @hoist_loads_and_stores_multiple_exits
590
629
// CHECK: [[V1:%[0-9]+]] = load %0
591
630
// CHECK: br bb1([[V1]] : $Int32)
0 commit comments