Skip to content

Commit 12f8e62

Browse files
committed
[embedded] Start flagging AllocRefDynamicInst usage in embedded Swift
1 parent 5e0bcab commit 12f8e62

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
@@ -448,7 +448,7 @@ static bool metatypeUsesAreNotRelevant(MetatypeInst *mt) {
448448
}
449449

450450
static bool allowedMetadataUseInEmbeddedSwift(SILInstruction *inst) {
451-
// Only diagnose metatype and value_metatype instructions, for now.
451+
// Only diagnose metatype, value_metatype instructions, ...
452452
if ((isa<ValueMetatypeInst>(inst) || isa<MetatypeInst>(inst))) {
453453
auto metaTy = cast<SingleValueInstruction>(inst)->getType().castTo<MetatypeType>();
454454
if (metaTy->getRepresentation() == MetatypeRepresentation::Thick) {
@@ -458,6 +458,9 @@ static bool allowedMetadataUseInEmbeddedSwift(SILInstruction *inst) {
458458
// Class metadata are supported in embedded Swift
459459
return instTy->getClassOrBoundGenericClass() ? true : false;
460460
}
461+
// ... and alloc_ref_dynamic, for now.
462+
} else if (isa<AllocRefDynamicInst>(inst)) {
463+
return false;
461464
}
462465

463466
return true;

0 commit comments

Comments
 (0)