Skip to content

Commit a461faf

Browse files
committed
Fix a PerformanceInliner crash caused by a null callee signature.
This is an obvious drive-by fix. It will crash when building Foundation after I commit changes to the pipeline. My attempts at creating a unit test were unsuccessful because it depends on some interaction between inlining and specialization heuristics.
1 parent bfc2753 commit a461faf

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)