Skip to content

Commit 829f442

Browse files
authored
Merge pull request #70441 from kubamracek/embedded-diagnose-alloc-ref-dynamic
[embedded] Start flagging AllocRefDynamicInst usage in embedded Swift
2 parents 01654fd + 12f8e62 commit 829f442

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/SILOptimizer/Mandatory/PerformanceDiagnostics.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static bool metatypeUsesAreNotRelevant(MetatypeInst *mt) {
458458
}
459459

460460
static bool allowedMetadataUseInEmbeddedSwift(SILInstruction *inst) {
461-
// Only diagnose metatype and value_metatype instructions, for now.
461+
// Only diagnose metatype, value_metatype instructions, ...
462462
if ((isa<ValueMetatypeInst>(inst) || isa<MetatypeInst>(inst))) {
463463
auto metaTy = cast<SingleValueInstruction>(inst)->getType().castTo<MetatypeType>();
464464
if (metaTy->getRepresentation() == MetatypeRepresentation::Thick) {
@@ -468,6 +468,9 @@ static bool allowedMetadataUseInEmbeddedSwift(SILInstruction *inst) {
468468
// Class metadata are supported in embedded Swift
469469
return instTy->getClassOrBoundGenericClass() ? true : false;
470470
}
471+
// ... and alloc_ref_dynamic, for now.
472+
} else if (isa<AllocRefDynamicInst>(inst)) {
473+
return false;
471474
}
472475

473476
return true;

0 commit comments

Comments
 (0)