@@ -5,6 +5,7 @@ sil_stage canonical
5
5
6
6
import Builtin
7
7
import Swift
8
+ import SwiftShims
8
9
9
10
///////////////////////
10
11
// Type Declarations //
@@ -1348,6 +1349,29 @@ bb0(%0 : $*Int):
1348
1349
}
1349
1350
// CHECK-LABEL: } // end sil function 'test_rle_in_guaranteed_entry'
1350
1351
1352
+ sil shared [clang _swift_stdlib_has_malloc_size] @_swift_stdlib_has_malloc_size : $@convention(c) () -> Bool
1353
+ sil shared [clang _swift_stdlib_malloc_size] @_swift_stdlib_malloc_size : $@convention(c) (UnsafeRawPointer) -> Int
1354
+
1355
+ // CHECK-LABEL: sil [ossa] @ignoreMallocSize :
1356
+ // CHECK: [[VAL:%.*]] = load
1357
+ // CHECK: [[UI:%.*]] = function_ref @use_Int
1358
+ // CHECK: apply [[UI]]([[VAL]])
1359
+ // CHECK: return [[VAL]]
1360
+ // CHECK-LABEL: } // end sil function 'ignoreMallocSize'
1361
+ sil [ossa] @ignoreMallocSize : $@convention(thin) (@guaranteed AB, UnsafeRawPointer) -> Int {
1362
+ bb0(%0 : @guaranteed $AB, %1 : $UnsafeRawPointer):
1363
+ %2 = ref_element_addr %0 : $AB, #AB.value
1364
+ %3 = load [trivial] %2 : $*Int
1365
+ %4 = function_ref @_swift_stdlib_has_malloc_size : $@convention(c) () -> Bool
1366
+ %5 = apply %4() : $@convention(c) () -> Bool
1367
+ %6 = function_ref @_swift_stdlib_malloc_size : $@convention(c) (UnsafeRawPointer) -> Int
1368
+ %7 = apply %6(%1) : $@convention(c) (UnsafeRawPointer) -> Int
1369
+ %8 = load [trivial] %2 : $*Int
1370
+ %9 = function_ref @use_Int : $@convention(thin) (Int) -> ()
1371
+ apply %9(%3) : $@convention(thin) (Int) -> ()
1372
+ return %8 : $Int
1373
+ }
1374
+
1351
1375
// Check that begin_access, end_access, strong_release, set_deallocating, and dealloc_ref don't prevent optimization.
1352
1376
// CHECK-LABEL: ignore_read_write :
1353
1377
// CHECK: bb0
0 commit comments