Skip to content

Commit 9d75c30

Browse files
committed
SIL: fix the runtime effect of alloc_global
It was too conservative
1 parent 1cbea04 commit 9d75c30

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SIL/Utils/InstructionUtils.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
596596
case SILInstructionKind::AllocGlobalInst: {
597597
SILType glTy = cast<AllocGlobalInst>(inst)->getReferencedGlobal()->
598598
getLoweredType();
599+
if (glTy.isLoadable(*inst->getFunction()))
600+
return RuntimeEffect::NoEffect;
599601
if (glTy.hasOpaqueArchetype()) {
600602
impactType = glTy;
601603
return RuntimeEffect::Allocating | RuntimeEffect::MetaData;

0 commit comments

Comments
 (0)