Skip to content

Commit 563516b

Browse files
committed
Reclaim unresolved local archetypes before exiting early
1 parent 7d4e82f commit 563516b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/SILOptimizer/IPO/CrossModuleOptimization.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,16 @@ bool CrossModuleOptimization::canSerializeFunction(
499499
// First, visit each instruction and see if its lowered types
500500
// are serializalbe and track them in a map.
501501
visitor.visit(&inst);
502-
if (!visitor.canSerializeTypesInInst(&inst))
502+
if (!visitor.canSerializeTypesInInst(&inst)) {
503+
M.reclaimUnresolvedLocalArchetypeDefinitions();
503504
return false;
505+
}
504506
// If serializable, check if any fields in the instruction (that
505507
// are not covered in the visitor) can be serialized.
506-
if (!canSerializeFieldsByInstructionKind(&inst, canSerializeFlags, maxDepth))
508+
if (!canSerializeFieldsByInstructionKind(&inst, canSerializeFlags, maxDepth)) {
509+
M.reclaimUnresolvedLocalArchetypeDefinitions();
507510
return false;
511+
}
508512
}
509513
}
510514
M.reclaimUnresolvedLocalArchetypeDefinitions();

0 commit comments

Comments
 (0)