Skip to content

Allow shared_external functions to be considered by interprocedural analysis #14568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ bool CalleeList::allCalleesVisible() {
// Do not consider functions in other modules (libraries) because of library
// evolution: such function may behave differently in future/past versions
// of the library.
if (Callee->isAvailableExternally())
// TODO: exclude functions which are deserialized from modules in the same
// resilience domain.
if (Callee->isAvailableExternally() &&
// shared_external functions are always emitted in the client.
Callee->getLinkage() != SILLinkage::SharedExternal)
return false;
}
return true;
Expand Down
16 changes: 16 additions & 0 deletions test/SILOptimizer/side-effect.sil
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,19 @@ bb0:
return %r : $()
}

sil shared_external @shared_external_func : $@convention(thin) () -> () {
bb0:
%r = tuple ()
return %r : $()
}

// CHECK-LABEL: sil @call_shared_external_func
// CHECK-NEXT: <func=>
sil @call_shared_external_func : $@convention(thin) () -> () {
bb0:
%u = function_ref @shared_external_func : $@convention(thin) () -> ()
%a = apply %u() : $@convention(thin) () -> ()
%r = tuple ()
return %r : $()
}