Skip to content

Commit 117537d

Browse files
committed
[DAG] ExpandIntRes_Shift - pull out repeated getOpcode() calls. NFC.
1 parent b19cfb9 commit 117537d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4527,6 +4527,7 @@ void DAGTypeLegalizer::ExpandIntRes_ShiftThroughStack(SDNode *N, SDValue &Lo,
45274527
void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
45284528
SDValue &Lo, SDValue &Hi) {
45294529
EVT VT = N->getValueType(0);
4530+
unsigned Opc = N->getOpcode();
45304531
SDLoc dl(N);
45314532

45324533
// If we can emit an efficient shift operation, do so now. Check to see if
@@ -4541,12 +4542,12 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
45414542

45424543
// If this target supports shift_PARTS, use it. First, map to the _PARTS opc.
45434544
unsigned PartsOpc;
4544-
if (N->getOpcode() == ISD::SHL) {
4545+
if (Opc == ISD::SHL) {
45454546
PartsOpc = ISD::SHL_PARTS;
4546-
} else if (N->getOpcode() == ISD::SRL) {
4547+
} else if (Opc == ISD::SRL) {
45474548
PartsOpc = ISD::SRL_PARTS;
45484549
} else {
4549-
assert(N->getOpcode() == ISD::SRA && "Unknown shift!");
4550+
assert(Opc == ISD::SRA && "Unknown shift!");
45504551
PartsOpc = ISD::SRA_PARTS;
45514552
}
45524553

@@ -4599,7 +4600,7 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
45994600
// Otherwise, emit a libcall.
46004601
RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
46014602
bool isSigned;
4602-
if (N->getOpcode() == ISD::SHL) {
4603+
if (Opc == ISD::SHL) {
46034604
isSigned = false; /*sign irrelevant*/
46044605
if (VT == MVT::i16)
46054606
LC = RTLIB::SHL_I16;
@@ -4609,7 +4610,7 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
46094610
LC = RTLIB::SHL_I64;
46104611
else if (VT == MVT::i128)
46114612
LC = RTLIB::SHL_I128;
4612-
} else if (N->getOpcode() == ISD::SRL) {
4613+
} else if (Opc == ISD::SRL) {
46134614
isSigned = false;
46144615
if (VT == MVT::i16)
46154616
LC = RTLIB::SRL_I16;
@@ -4620,7 +4621,7 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
46204621
else if (VT == MVT::i128)
46214622
LC = RTLIB::SRL_I128;
46224623
} else {
4623-
assert(N->getOpcode() == ISD::SRA && "Unknown shift!");
4624+
assert(Opc == ISD::SRA && "Unknown shift!");
46244625
isSigned = true;
46254626
if (VT == MVT::i16)
46264627
LC = RTLIB::SRA_I16;

0 commit comments

Comments
 (0)