SILOptimizer: Fix speculative devirtualizer with dynamic Self

The testcase exercises this when run with check-swift-optimized.
This commit is contained in:
Slava Pestov
2017-01-09 21:44:58 -08:00
parent 8efe0641d5
commit 994dbfe9ec
2 changed files with 62 additions and 0 deletions

View File

@@ -95,6 +95,9 @@ static FullApplySite speculateMonomorphicTarget(FullApplySite AI,
if (!canDevirtualizeClassMethod(AI, SubType))
return FullApplySite();
if (SubType.getSwiftRValueType()->hasDynamicSelfType())
return FullApplySite();
// Create a diamond shaped control flow and a checked_cast_branch
// instruction that checks the exact type of the object.
// This cast selects between two paths: one that calls the slow dynamic