Skip to content

Commit 90d5d86

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 93e209c commit 90d5d86

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
@@ -1296,18 +1296,16 @@ bool SILInstruction::mayRequirePackMetadata() const {
12961296
}
12971297
return false;
12981298
}
1299-
case SILInstructionKind::DebugValueInst: {
1300-
auto *dvi = cast<DebugValueInst>(this);
1301-
return dvi->getOperand()->getType().hasPack();
1299+
case SILInstructionKind::ClassMethodInst:
1300+
case SILInstructionKind::DebugValueInst:
1301+
// Unary instructions.
1302+
{
1303+
return getOperand(0)->getType().hasPack();
13021304
}
13031305
case SILInstructionKind::MetatypeInst: {
13041306
auto *mi = cast<MetatypeInst>(this);
13051307
return mi->getType().hasPack();
13061308
}
1307-
case SILInstructionKind::ClassMethodInst: {
1308-
auto *cmi = cast<ClassMethodInst>(this);
1309-
return cmi->getOperand()->getType().hasPack();
1310-
}
13111309
case SILInstructionKind::WitnessMethodInst: {
13121310
auto *wmi = cast<WitnessMethodInst>(this);
13131311
auto ty = wmi->getLookupType();

0 commit comments

Comments
 (0)