Skip to content

Commit dee44b2

Browse files
committed
[X86] combineBitOpWithShift - avoid duplicate SDLoc/operands code. NFC.
Reuse values from the callers directly.
1 parent 1bc87c9 commit dee44b2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49888,15 +49888,12 @@ static SDValue combineBitOpWithMOVMSK(SDNode *N, SelectionDAG &DAG) {
4988849888
// Attempt to fold BITOP(SHIFT(X,Z),SHIFT(Y,Z)) -> SHIFT(BITOP(X,Y),Z).
4988949889
// NOTE: This is a very limited case of what SimplifyUsingDistributiveLaws
4989049890
// handles in InstCombine.
49891-
static SDValue combineBitOpWithShift(SDNode *N, SelectionDAG &DAG) {
49892-
unsigned Opc = N->getOpcode();
49891+
static SDValue combineBitOpWithShift(unsigned Opc, const SDLoc &DL, EVT VT,
49892+
SDValue N0, SDValue N1,
49893+
SelectionDAG &DAG) {
4989349894
assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
4989449895
"Unexpected bit opcode");
4989549896

49896-
SDValue N0 = N->getOperand(0);
49897-
SDValue N1 = N->getOperand(1);
49898-
EVT VT = N->getValueType(0);
49899-
4990049897
// Both operands must be single use.
4990149898
if (!N0.hasOneUse() || !N1.hasOneUse())
4990249899
return SDValue();
@@ -49916,8 +49913,6 @@ static SDValue combineBitOpWithShift(SDNode *N, SelectionDAG &DAG) {
4991649913
case X86ISD::VSRAI: {
4991749914
if (BC0.getOperand(1) != BC1.getOperand(1))
4991849915
return SDValue();
49919-
49920-
SDLoc DL(N);
4992149916
SDValue BitOp =
4992249917
DAG.getNode(Opc, DL, BCVT, BC0.getOperand(0), BC1.getOperand(0));
4992349918
SDValue Shift = DAG.getNode(BCOpc, DL, BCVT, BitOp, BC0.getOperand(1));
@@ -50529,7 +50524,7 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
5052950524
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
5053050525
return R;
5053150526

50532-
if (SDValue R = combineBitOpWithShift(N, DAG))
50527+
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
5053350528
return R;
5053450529

5053550530
if (SDValue R = combineBitOpWithPACK(N, DAG))
@@ -51314,7 +51309,7 @@ static SDValue combineOr(SDNode *N, SelectionDAG &DAG,
5131451309
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
5131551310
return R;
5131651311

51317-
if (SDValue R = combineBitOpWithShift(N, DAG))
51312+
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
5131851313
return R;
5131951314

5132051315
if (SDValue R = combineBitOpWithPACK(N, DAG))
@@ -53631,7 +53626,7 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
5363153626
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
5363253627
return R;
5363353628

53634-
if (SDValue R = combineBitOpWithShift(N, DAG))
53629+
if (SDValue R = combineBitOpWithShift(N->getOpcode(), DL, VT, N0, N1, DAG))
5363553630
return R;
5363653631

5363753632
if (SDValue R = combineBitOpWithPACK(N, DAG))

0 commit comments

Comments
 (0)