[llvm] 8ebd401 - [X86] combineBitOpWithPACK - avoid duplicate SDLoc/operands code. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 07:23:52 PDT 2024
Author: Simon Pilgrim
Date: 2024-10-06T15:23:38+01:00
New Revision: 8ebd4019500cbec28426f19e6440484d53ecaecd
URL: https://github.com/llvm/llvm-project/commit/8ebd4019500cbec28426f19e6440484d53ecaecd
DIFF: https://github.com/llvm/llvm-project/commit/8ebd4019500cbec28426f19e6440484d53ecaecd.diff
LOG: [X86] combineBitOpWithPACK - avoid duplicate SDLoc/operands code. NFC.
Reuse values from the callers directly.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index dc02b9adfdf219..8907a15b85e672 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -49922,15 +49922,11 @@ static SDValue combineBitOpWithShift(unsigned Opc, const SDLoc &DL, EVT VT,
// Attempt to fold:
// BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)).
// TODO: Handle PACKUS handling.
-static SDValue combineBitOpWithPACK(SDNode *N, SelectionDAG &DAG) {
- unsigned Opc = N->getOpcode();
+static SDValue combineBitOpWithPACK(unsigned Opc, const SDLoc &DL, EVT VT,
+ SDValue N0, SDValue N1, SelectionDAG &DAG) {
assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
"Unexpected bit opcode");
- SDValue N0 = N->getOperand(0);
- SDValue N1 = N->getOperand(1);
- EVT VT = N->getValueType(0);
-
// Both operands must be single use.
if (!N0.hasOneUse() || !N1.hasOneUse())
return SDValue();
@@ -49956,7 +49952,6 @@ static SDValue combineBitOpWithPACK(SDNode *N, SelectionDAG &DAG) {
DAG.ComputeNumSignBits(N1.getOperand(1)) != NumSrcBits)
return SDValue();
- SDLoc DL(N);
SDValue LHS = DAG.getNode(Opc, DL, SrcVT, N0.getOperand(0), N1.getOperand(0));
SDValue RHS = DAG.getNode(Opc, DL, SrcVT, N0.getOperand(1), N1.getOperand(1));
return DAG.getBitcast(VT, DAG.getNode(X86ISD::PACKSS, DL, DstVT, LHS, RHS));
@@ -50523,7 +50518,7 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
return R;
- if (SDValue R = combineBitOpWithPACK(N, DAG))
+ if (SDValue R = combineBitOpWithPACK(N->getOpcode(), dl, VT, N0, N1, DAG))
return R;
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
@@ -51308,7 +51303,7 @@ static SDValue combineOr(SDNode *N, SelectionDAG &DAG,
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
return R;
- if (SDValue R = combineBitOpWithPACK(N, DAG))
+ if (SDValue R = combineBitOpWithPACK(N->getOpcode(), dl, VT, N0, N1, DAG))
return R;
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
@@ -53625,7 +53620,7 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
if (SDValue R = combineBitOpWithShift(N->getOpcode(), DL, VT, N0, N1, DAG))
return R;
- if (SDValue R = combineBitOpWithPACK(N, DAG))
+ if (SDValue R = combineBitOpWithPACK(N->getOpcode(), DL, VT, N0, N1, DAG))
return R;
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
More information about the llvm-commits
mailing list