@@ -1458,3 +1458,103 @@ bb3:
1458
1458
%r = tuple ()
1459
1459
return %r : $()
1460
1460
}
1461
+
1462
+ // The bounds check isn't hoisted here since the array value for the isNativeTypeChecked is not available in the preheader
1463
+ // Ensure we don't fail verification
1464
+ sil [ossa] @isNativeUnavailable1 : $@convention(thin) (Int32, @owned ArrayInt) -> Int32 {
1465
+ bb0(%0 : $Int32, %1 : @owned $ArrayInt):
1466
+ %2 = integer_literal $Builtin.Int1, -1
1467
+ %3 = struct $Bool (%2)
1468
+ %4 = struct_extract %0, #Int32._value
1469
+ %5 = integer_literal $Builtin.Int32, 0
1470
+ %6 = builtin "cmp_eq_Int32"(%5, %4) : $Builtin.Int1
1471
+ %7 = begin_borrow %1
1472
+ %8 = copy_value %7
1473
+ %9 = function_ref @arrayPropertyIsNative : $@convention(method) (@guaranteed ArrayInt) -> Bool
1474
+ %10 = apply %9(%7) : $@convention(method) (@guaranteed ArrayInt) -> Bool
1475
+ end_borrow %7
1476
+ cond_br %6, bb2, bb1
1477
+
1478
+ bb1:
1479
+ br bb3(%5)
1480
+
1481
+ bb2:
1482
+ destroy_value %8
1483
+ destroy_value %1
1484
+ br bb6(%5)
1485
+
1486
+ bb3(%17 : $Builtin.Int32):
1487
+ %18 = struct $Int32 (%17)
1488
+ %19 = function_ref @checkbounds : $@convention(method) (Int32, Bool, @guaranteed ArrayInt) -> _DependenceToken
1489
+ %20 = apply %19(%18, %10, %8) : $@convention(method) (Int32, Bool, @guaranteed ArrayInt) -> _DependenceToken
1490
+ %21 = integer_literal $Builtin.Int32, 1
1491
+ %22 = integer_literal $Builtin.Int1, -1
1492
+ %23 = builtin "sadd_with_overflow_Int32"(%17, %21, %22) : $(Builtin.Int32, Builtin.Int1)
1493
+ %24 = tuple_extract %23, 0
1494
+ %25 = tuple_extract %23, 1
1495
+ cond_fail %25, ""
1496
+ %27 = builtin "cmp_eq_Int32"(%24, %4) : $Builtin.Int1
1497
+ cond_br %27, bb5, bb4
1498
+
1499
+ bb4:
1500
+ br bb3(%24)
1501
+
1502
+ bb5:
1503
+ destroy_value %8
1504
+ destroy_value %1
1505
+ br bb6(%24)
1506
+
1507
+ bb6(%33 : $Builtin.Int32):
1508
+ %34 = struct $Int32 (%33)
1509
+ return %34
1510
+ }
1511
+
1512
+ // The bounds check isn't hoisted here since the array value for the isNativeTypeChecked is not available in the preheader
1513
+ // Ensure we don't fail verification
1514
+ sil [ossa] @isNativeUnavailable2 : $@convention(thin) (Int32, @owned ArrayInt) -> Int32 {
1515
+ bb0(%0 : $Int32, %1 : @owned $ArrayInt):
1516
+ %2 = integer_literal $Builtin.Int1, -1
1517
+ %3 = struct $Bool (%2)
1518
+ %4 = struct_extract %0, #Int32._value
1519
+ %5 = integer_literal $Builtin.Int32, 0
1520
+ %6 = builtin "cmp_eq_Int32"(%5, %4) : $Builtin.Int1
1521
+ %7 = copy_value %1
1522
+ %8 = copy_value %7
1523
+ %9 = function_ref @arrayPropertyIsNative : $@convention(method) (@guaranteed ArrayInt) -> Bool
1524
+ %10 = apply %9(%7) : $@convention(method) (@guaranteed ArrayInt) -> Bool
1525
+ destroy_value %7
1526
+ cond_br %6, bb2, bb1
1527
+
1528
+ bb1:
1529
+ br bb3(%5)
1530
+
1531
+ bb2:
1532
+ destroy_value %8
1533
+ destroy_value %1
1534
+ br bb6(%5)
1535
+
1536
+ bb3(%17 : $Builtin.Int32):
1537
+ %18 = struct $Int32 (%17)
1538
+ %19 = function_ref @checkbounds : $@convention(method) (Int32, Bool, @guaranteed ArrayInt) -> _DependenceToken
1539
+ %20 = apply %19(%18, %10, %8) : $@convention(method) (Int32, Bool, @guaranteed ArrayInt) -> _DependenceToken
1540
+ %21 = integer_literal $Builtin.Int32, 1
1541
+ %22 = integer_literal $Builtin.Int1, -1
1542
+ %23 = builtin "sadd_with_overflow_Int32"(%17, %21, %22) : $(Builtin.Int32, Builtin.Int1)
1543
+ %24 = tuple_extract %23, 0
1544
+ %25 = tuple_extract %23, 1
1545
+ cond_fail %25, ""
1546
+ %27 = builtin "cmp_eq_Int32"(%24, %4) : $Builtin.Int1
1547
+ cond_br %27, bb5, bb4
1548
+
1549
+ bb4:
1550
+ br bb3(%24)
1551
+
1552
+ bb5:
1553
+ destroy_value %8
1554
+ destroy_value %1
1555
+ br bb6(%24)
1556
+
1557
+ bb6(%33 : $Builtin.Int32):
1558
+ %34 = struct $Int32 (%33)
1559
+ return %34
1560
+ }
0 commit comments