Skip to content

Commit b0911d1

Browse files
committed
[IRGen] Insts with packs in ops/results may alloc.
Instead of assuming that the list of instructions known to allocate pack metadata is exhaustive and returning false from mayRequirePackMetadata for all others, consider the types of the results and operands of other instructions and look for packs.
1 parent 471c978 commit b0911d1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/SIL/IR/SILInstruction.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,26 @@ bool SILInstruction::mayRequirePackMetadata() const {
13181318
return ty->hasAnyPack();
13191319
}
13201320
default:
1321+
// DeallocationInst subclasses. They can never result in metadata
1322+
// materialization.
1323+
if (isa<DeallocationInst>(this))
1324+
return false;
1325+
1326+
// Check results and operands for packs. If a pack appears, lowering the
1327+
// instruction might result in pack metadata emission.
1328+
for (auto result : getResults()) {
1329+
if (result->getType().hasAnyPack())
1330+
return true;
1331+
}
1332+
for (auto operandTy : getOperandTypes()) {
1333+
if (operandTy.hasAnyPack())
1334+
return true;
1335+
}
1336+
for (auto &tdo : getTypeDependentOperands()) {
1337+
if (tdo.get()->getType().hasAnyPack())
1338+
return true;
1339+
}
1340+
13211341
return false;
13221342
}
13231343
}

0 commit comments

Comments
 (0)