Skip to content

Commit c078b76

Browse files
committed
Don't serialize derived function effects for function with @_semantics("optimize.no.crossmodule")
1 parent 173b698 commit c078b76

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Serialization/SerializeSIL.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,12 @@ void SILSerializer::writeSILFunction(const SILFunction &F, bool DeclOnly) {
488488
unsigned numAttrs = NoBody ? 0 : F.getSpecializeAttrs().size();
489489

490490
auto resilience = F.getModule().getSwiftModule()->getResilienceStrategy();
491+
bool serializeDerivedEffects = (resilience != ResilienceStrategy::Resilient) &&
492+
!F.hasSemanticsAttr("optimize.no.crossmodule");
493+
491494
F.visitArgEffects(
492495
[&](int effectIdx, int argumentIndex, bool isDerived) {
493-
if (isDerived && resilience == ResilienceStrategy::Resilient)
496+
if (isDerived && !serializeDerivedEffects)
494497
return;
495498
numAttrs++;
496499
});
@@ -520,7 +523,7 @@ void SILSerializer::writeSILFunction(const SILFunction &F, bool DeclOnly) {
520523

521524
F.visitArgEffects(
522525
[&](int effectIdx, int argumentIndex, bool isDerived) {
523-
if (isDerived && resilience == ResilienceStrategy::Resilient)
526+
if (isDerived && !serializeDerivedEffects)
524527
return;
525528

526529
llvm::SmallString<64> buffer;

0 commit comments

Comments
 (0)