Skip to content

Devirtualizer: enable inline an inlinable function into a non-inlinable function #17337

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
Jun 19, 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
8 changes: 3 additions & 5 deletions lib/SILOptimizer/Utils/Devirtualize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,11 @@ bool swift::canDevirtualizeClassMethod(FullApplySite AI,
}

// We need to disable the “effectively final” opt if a function is inlinable
if (isEffectivelyFinalMethod &&
((F->getResilienceExpansion() == ResilienceExpansion::Minimal) ||
AI.getFunction()->getResilienceExpansion() ==
ResilienceExpansion::Minimal)) {
if (isEffectivelyFinalMethod && AI.getFunction()->getResilienceExpansion() ==
ResilienceExpansion::Minimal) {
DEBUG(llvm::dbgs() << " FAIL: Could not optimize function because "
"it is an effectively-final inlinable: "
<< F->getName() << "\n");
<< AI.getFunction()->getName() << "\n");
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions test/SILOptimizer/devirt_access_serialized.sil
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ sil @_TFC14devirt_access21YcfMS0_FT_S0_ : $@convention(method) (@owned Y) -> @ow
sil @_TFC14devirt_access21YCfMS0_FT_S0_ : $@convention(thin) (@thick Y.Type) -> @owned Y

//CHECK-LABEL: sil @Case
//CHECK-NOT: function_ref @_TFC14devirt_access21X4pingfS0_FT_Si
//CHECK: class_method
//CHECK: function_ref @_TFC14devirt_access21X4pingfS0_FT_Si : $@convention(method) (@guaranteed X)
//CHECK-NOT: class_method
//CHECK: apply
//CHECK: return
sil @Case : $@convention(thin) (@owned Y) -> Int {
Expand Down