Skip to content

Commit 4035c18

Browse files
committed
SIL: relax the runtime effect of copy_addr
It only needs metadata if the copied type has an archetype
1 parent dbeda96 commit 4035c18

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SIL/Utils/InstructionUtils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,9 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
841841
return RuntimeEffect::MetaData | RuntimeEffect::Releasing;
842842
if (!ca->isTakeOfSrc())
843843
return RuntimeEffect::MetaData | RuntimeEffect::RefCounting;
844-
return RuntimeEffect::MetaData;
844+
if (ca->getSrc()->getType().hasArchetype())
845+
return RuntimeEffect::MetaData;
846+
return RuntimeEffect::NoEffect;
845847
}
846848
case SILInstructionKind::TupleAddrConstructorInst: {
847849
auto *ca = cast<TupleAddrConstructorInst>(inst);

0 commit comments

Comments
 (0)