Skip to content

Commit f893a28

Browse files
committed
Optimizer fixes found by compiling the benchmarks with -enable-implicit-dynamic
1 parent eebccb7 commit f893a28

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/SILOptimizer/IPO/ClosureSpecializer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,8 @@ bool SILClosureSpecializerTransform::gatherCallSites(
10351035
// so continue...
10361036
auto AI = FullApplySite::isa(Use->getUser());
10371037
if (!AI || AI.hasSubstitutions() ||
1038-
!canSpecializeFullApplySite(AI.getKind()))
1038+
!canSpecializeFullApplySite(AI.getKind()) ||
1039+
!AI.canOptimize())
10391040
continue;
10401041

10411042
// Check if we have already associated this apply inst with a closure to

lib/SILOptimizer/Utils/SpecializationMangler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ FunctionSignatureSpecializationMangler::mangleConstantProp(LiteralInst *LI) {
202202
switch (LI->getKind()) {
203203
default:
204204
llvm_unreachable("unknown literal");
205+
case SILInstructionKind::DynamicFunctionRefInst: {
206+
SILFunction *F = cast<DynamicFunctionRefInst>(LI)->getReferencedFunction();
207+
ArgOpBuffer << 'f';
208+
appendIdentifier(F->getName());
209+
break;
210+
}
205211
case SILInstructionKind::FunctionRefInst: {
206212
SILFunction *F = cast<FunctionRefInst>(LI)->getReferencedFunction();
207213
ArgOpBuffer << 'f';

0 commit comments

Comments
 (0)