@@ -61,6 +61,8 @@ bb0(%0: @guaranteed $ArrayInt):
61
61
unreachable
62
62
}
63
63
64
+ sil [ossa] @nonconst : $@convention(thin) () -> Builtin.Int32
65
+
64
66
sil [ossa] @unknown_func : $@convention(thin) () -> () {
65
67
bb0:
66
68
unreachable
@@ -1289,3 +1291,41 @@ bb6(%32 : $Builtin.Int32):
1289
1291
return %33 : $Int32
1290
1292
}
1291
1293
1294
+ // CHECK-LABEL: sil [ossa] @non_const_post_increment :
1295
+ // CHECK-NOT: apply
1296
+ // CHECK: bb1({{.*}}):
1297
+ // CHECK: function_ref @nonconst
1298
+ // CHECK: apply
1299
+ // CHECK: function_ref @checkbounds2
1300
+ // CHECK: apply
1301
+ // CHECK: bb2:
1302
+ // CHECK: } // end sil function 'non_const_post_increment'
1303
+ sil [ossa] @non_const_post_increment : $@convention(thin) (@guaranteed Array<Int>) -> () {
1304
+ bb0(%0 : @guaranteed $Array<Int>):
1305
+ %t = integer_literal $Builtin.Int1, -1
1306
+ %ts = struct $Bool (%t : $Builtin.Int1)
1307
+ %zero = integer_literal $Builtin.Int32, 0
1308
+ %one = integer_literal $Builtin.Int32, 1
1309
+ %ten = integer_literal $Builtin.Int32, 10
1310
+ br bb1(%zero : $Builtin.Int32)
1311
+
1312
+ bb1(%i : $Builtin.Int32):
1313
+ %a1 = builtin "sadd_with_overflow_Int32"(%i : $Builtin.Int32, %one : $Builtin.Int32, %t : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
1314
+ %i1 = tuple_extract %a1 : $(Builtin.Int32, Builtin.Int1), 0
1315
+ %nf = function_ref @nonconst : $@convention(thin) () -> Builtin.Int32
1316
+ %nc = apply %nf() : $@convention(thin) () -> Builtin.Int32
1317
+ %a2 = builtin "sadd_with_overflow_Int32"(%i : $Builtin.Int32, %nc : $Builtin.Int32, %t : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
1318
+ %idx = tuple_extract %a2 : $(Builtin.Int32, Builtin.Int1), 0
1319
+ %idxs = struct $Int32 (%idx : $Builtin.Int32)
1320
+ %f2 = function_ref @checkbounds2 : $@convention(method) (Int32, Bool, @guaranteed Array<Int>) -> _DependenceToken
1321
+ apply %f2(%idxs, %ts, %0) : $@convention(method) (Int32, Bool, @guaranteed Array<Int>) -> _DependenceToken
1322
+ %c = builtin "cmp_eq_Int32"(%i1 : $Builtin.Int32, %ten : $Builtin.Int32) : $Builtin.Int1
1323
+ cond_br %c, bb3, bb2
1324
+
1325
+ bb2:
1326
+ br bb1(%i1 : $Builtin.Int32)
1327
+
1328
+ bb3:
1329
+ %r = tuple ()
1330
+ return %r : $()
1331
+ }
0 commit comments