Skip to content

Commit bd9daae

Browse files
committed
[IRGen] NFC: Unified unary instructions.
In preparation for adding addition unary instructions which `mayRequirePackMetadata`, group the instructions which already may produce pack metadata depending on their single operand's type together.
1 parent 7fb670d commit bd9daae

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/SIL/IR/SILInstruction.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,18 +1314,16 @@ bool SILInstruction::mayRequirePackMetadata() const {
13141314
}
13151315
return false;
13161316
}
1317-
case SILInstructionKind::DebugValueInst: {
1318-
auto *dvi = cast<DebugValueInst>(this);
1319-
return dvi->getOperand()->getType().hasPack();
1317+
case SILInstructionKind::ClassMethodInst:
1318+
case SILInstructionKind::DebugValueInst:
1319+
// Unary instructions.
1320+
{
1321+
return getOperand(0)->getType().hasPack();
13201322
}
13211323
case SILInstructionKind::MetatypeInst: {
13221324
auto *mi = cast<MetatypeInst>(this);
13231325
return mi->getType().hasPack();
13241326
}
1325-
case SILInstructionKind::ClassMethodInst: {
1326-
auto *cmi = cast<ClassMethodInst>(this);
1327-
return cmi->getOperand()->getType().hasPack();
1328-
}
13291327
case SILInstructionKind::WitnessMethodInst: {
13301328
auto *wmi = cast<WitnessMethodInst>(this);
13311329
auto ty = wmi->getLookupType();

0 commit comments

Comments
 (0)