Skip to content

Commit 7e3f8d9

Browse files
authored
Merge pull request #23473 from atrick/fix-inline-canspecialize
Fix a PerformanceInliner crash caused by a null callee signature.
2 parents a67f3b9 + a461faf commit 7e3f8d9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ bool SILPerformanceInliner::isProfitableToInline(
363363
auto Subs = FAI.getSubstitutionMap();
364364

365365
// Bail if it is not a generic call or inlining of generics is forbidden.
366-
if (!EnableSILInliningOfGenerics || Subs.empty())
366+
if (!EnableSILInliningOfGenerics || !Subs.hasAnySubstitutableParams())
367367
continue;
368368

369369
if (!isa<FunctionRefInst>(def) && !isa<ClassMethodInst>(def) &&

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ static bool shouldNotSpecialize(SILFunction *Callee, SILFunction *Caller,
390390
bool ReabstractionInfo::prepareAndCheck(ApplySite Apply, SILFunction *Callee,
391391
SubstitutionMap ParamSubs,
392392
OptRemark::Emitter *ORE) {
393+
assert(ParamSubs.hasAnySubstitutableParams());
394+
393395
if (shouldNotSpecialize(Callee, Apply ? Apply.getFunction() : nullptr))
394396
return false;
395397

0 commit comments

Comments
 (0)