Skip to content

Commit fb3ed8a

Browse files
authored
Merge pull request #14568 from eeckstein/allow-shared-external
Allow shared_external functions to be considered by interprocedural analysis
2 parents 79d29dc + 1b7b389 commit fb3ed8a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ bool CalleeList::allCalleesVisible() {
3434
// Do not consider functions in other modules (libraries) because of library
3535
// evolution: such function may behave differently in future/past versions
3636
// of the library.
37-
if (Callee->isAvailableExternally())
37+
// TODO: exclude functions which are deserialized from modules in the same
38+
// resilience domain.
39+
if (Callee->isAvailableExternally() &&
40+
// shared_external functions are always emitted in the client.
41+
Callee->getLinkage() != SILLinkage::SharedExternal)
3842
return false;
3943
}
4044
return true;

test/SILOptimizer/side-effect.sil

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,19 @@ bb0:
506506
return %r : $()
507507
}
508508

509+
sil shared_external @shared_external_func : $@convention(thin) () -> () {
510+
bb0:
511+
%r = tuple ()
512+
return %r : $()
513+
}
514+
515+
// CHECK-LABEL: sil @call_shared_external_func
516+
// CHECK-NEXT: <func=>
517+
sil @call_shared_external_func : $@convention(thin) () -> () {
518+
bb0:
519+
%u = function_ref @shared_external_func : $@convention(thin) () -> ()
520+
%a = apply %u() : $@convention(thin) () -> ()
521+
%r = tuple ()
522+
return %r : $()
523+
}
524+

0 commit comments

Comments
 (0)