File tree 4 files changed +38
-8
lines changed
include/swift/SILOptimizer/Analysis
lib/SILOptimizer/Analysis
4 files changed +38
-8
lines changed Original file line number Diff line number Diff line change @@ -295,10 +295,7 @@ class FunctionAccessStorage {
295
295
// / the callee.
296
296
// /
297
297
// / TODO: Summarize ArraySemanticsCall accesses.
298
- bool summarizeCall (FullApplySite fullApply) {
299
- assert (accessResult.isEmpty () && " expected uninitialized results." );
300
- return false ;
301
- }
298
+ bool summarizeCall (FullApplySite fullApply);
302
299
303
300
// / Merge effects directly from \p RHS.
304
301
bool mergeFrom (const FunctionAccessStorage &RHS) {
Original file line number Diff line number Diff line change @@ -380,6 +380,19 @@ bool FunctionAccessStorage::summarizeFunction(SILFunction *F) {
380
380
return true ;
381
381
}
382
382
383
+ bool FunctionAccessStorage::summarizeCall (FullApplySite fullApply) {
384
+ assert (accessResult.isEmpty () && " expected uninitialized results." );
385
+
386
+ if (SILFunction *callee = fullApply.getReferencedFunctionOrNull ()) {
387
+ if (callee->getName () == " _swift_stdlib_malloc_size" ||
388
+ callee->getName () == " _swift_stdlib_has_malloc_size" ) {
389
+ return true ;
390
+ }
391
+ }
392
+
393
+ return false ;
394
+ }
395
+
383
396
SILAnalysis *swift::createAccessStorageAnalysis (SILModule *) {
384
397
return new AccessStorageAnalysis ();
385
398
}
Original file line number Diff line number Diff line change @@ -1874,3 +1874,23 @@ bb0(%0 : @owned $NonTrivial):
1874
1874
destroy_value %0 : $NonTrivial
1875
1875
return undef : $()
1876
1876
}
1877
+
1878
+ sil shared [clang _swift_stdlib_has_malloc_size] @_swift_stdlib_has_malloc_size : $@convention(c) () -> Bool
1879
+ sil shared [clang _swift_stdlib_malloc_size] @_swift_stdlib_malloc_size : $@convention(c) (UnsafeRawPointer) -> Int
1880
+
1881
+ // CHECK-LABEL: sil [ossa] @ignoreMallocSize :
1882
+ // CHECK: begin_access [read] [dynamic] [no_nested_conflict]
1883
+ // CHECK-LABEL: } // end sil function 'ignoreMallocSize'
1884
+ sil [ossa] @ignoreMallocSize : $@convention(thin) (UnsafeRawPointer) -> () {
1885
+ bb0(%0 : $UnsafeRawPointer):
1886
+ %2 = global_addr @globalX: $*X
1887
+ %3 = begin_access [read] [dynamic] %2 : $*X
1888
+ %4 = function_ref @_swift_stdlib_has_malloc_size : $@convention(c) () -> Bool
1889
+ %5 = apply %4() : $@convention(c) () -> Bool
1890
+ %6 = function_ref @_swift_stdlib_malloc_size : $@convention(c) (UnsafeRawPointer) -> Int
1891
+ %7 = apply %6(%0) : $@convention(c) (UnsafeRawPointer) -> Int
1892
+ end_access %3 : $*X
1893
+ %9 = tuple ()
1894
+ return %9 : $()
1895
+ }
1896
+
Original file line number Diff line number Diff line change @@ -377,13 +377,13 @@ private struct EscapedTransforme<T>: WriteProt {
377
377
378
378
// TESTSIL-LABEL: sil [noinline] @$s17merge_exclusivity14run_MergeTest9yySiF : $@convention(thin)
379
379
// TESTSIL: [[REFADDR:%.*]] = ref_element_addr {{.*}} : $StreamClass, #StreamClass.buffer
380
- // TESTSIL-NEXT: [[B1:%.*]] = begin_access [modify] [dynamic ] [no_nested_conflict] [[REFADDR]]
380
+ // TESTSIL-NEXT: [[B1:%.*]] = begin_access [modify] [{{.*}} ] [no_nested_conflict] [[REFADDR]]
381
381
// TESTSIL: end_access [[B1]]
382
- // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [dynamic ] [[REFADDR]]
382
+ // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [{{.*}} ] [[REFADDR]]
383
383
// TESTSIL: end_access [[BCONF]]
384
- // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [dynamic ] [[REFADDR]]
384
+ // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [{{.*}} ] [[REFADDR]]
385
385
// TESTSIL: end_access [[BCONF]]
386
- // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [dynamic ] [[REFADDR]]
386
+ // TESTSIL: [[BCONF:%.*]] = begin_access [modify] [{{.*}} ] [[REFADDR]]
387
387
// TESTSIL: end_access [[BCONF]]
388
388
// TESTSIL-LABEL: } // end sil function '$s17merge_exclusivity14run_MergeTest9yySiF'
389
389
@inline ( never)
You can’t perform that action at this time.
0 commit comments