Skip to content

Commit cc9e8a6

Browse files
authored
Merge pull request #11856 from gottesmm/pr-7dd024ba65ad7cdb4b8c0a955135af92e3368d6a
2 parents b8c581b + 54dbdbc commit cc9e8a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ runOnFunctionRecursively(SILFunction *F, FullApplySite AI,
395395

396396
auto *ApplyBlock = InnerAI.getParent();
397397

398+
// *NOTE* If devirtualization succeeds, sometimes II will not be InnerAI,
399+
// but a casted result of InnerAI or even a block argument due to
400+
// abstraction changes when calling the witness or class method. We still
401+
// know that InnerAI dominates II though.
398402
std::tie(InnerAI, II) = tryDevirtualizeApplyHelper(InnerAI, II, CHA);
399403
if (!InnerAI)
400404
continue;
@@ -465,6 +469,9 @@ runOnFunctionRecursively(SILFunction *F, FullApplySite AI,
465469
SILInliner::InlineKind::MandatoryInline, ApplySubs,
466470
OpenedArchetypesTracker);
467471
if (!Inliner.canInlineFunction(InnerAI)) {
472+
// See comment above about casting when devirtualizing and how this
473+
// sometimes causes II and InnerAI to be different and even in different
474+
// blocks.
468475
II = InnerAI.getInstruction()->getIterator();
469476
continue;
470477
}

0 commit comments

Comments
 (0)