@@ -499,19 +499,23 @@ bool CrossModuleOptimization::canSerializeFunction(
499
499
// First, visit each instruction and see if its lowered types
500
500
// are serializalbe and track them in a map.
501
501
visitor.visit (&inst);
502
- if (!visitor.canSerializeTypesInInst (&inst))
502
+ if (!visitor.canSerializeTypesInInst (&inst)) {
503
+ M.reclaimUnresolvedLocalArchetypeDefinitions ();
503
504
return false ;
505
+ }
504
506
// If serializable, check if any fields in the instruction (that
505
507
// are not covered in the visitor) can be serialized.
506
- if (!canSerializeFieldsByInstructionKind (&inst, canSerializeFlags, maxDepth))
508
+ if (!canSerializeFieldsByInstructionKind (&inst, canSerializeFlags, maxDepth)) {
509
+ M.reclaimUnresolvedLocalArchetypeDefinitions ();
507
510
return false ;
508
-
511
+ }
509
512
for (SILValue result : inst.getResults ()) {
510
513
if (!canSerializeType (result->getType ())) {
511
514
llvm::dbgs () << " \n Checking result: \n " ;
512
515
inst.dump ();
513
516
llvm::dbgs () << " \n In function: \n " ;
514
517
inst.getFunction ()->dump ();
518
+ M.reclaimUnresolvedLocalArchetypeDefinitions ();
515
519
return false ;
516
520
}
517
521
}
@@ -521,6 +525,7 @@ bool CrossModuleOptimization::canSerializeFunction(
521
525
inst.dump ();
522
526
llvm::dbgs () << " \n In function: \n " ;
523
527
inst.getFunction ()->dump ();
528
+ M.reclaimUnresolvedLocalArchetypeDefinitions ();
524
529
return false ;
525
530
}
526
531
}
0 commit comments