[llvm] 614fab4 - [X86] PromoteMaskArithmetic - share the same SDLoc argument instead of recreating it over and over again.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 9 04:24:34 PST 2024
Author: Simon Pilgrim
Date: 2024-02-09T12:24:09Z
New Revision: 614fab49b0b47c6463fb4d9d788790345bfdb6ce
URL: https://github.com/llvm/llvm-project/commit/614fab49b0b47c6463fb4d9d788790345bfdb6ce
DIFF: https://github.com/llvm/llvm-project/commit/614fab49b0b47c6463fb4d9d788790345bfdb6ce.diff
LOG: [X86] PromoteMaskArithmetic - share the same SDLoc argument instead of recreating it over and over again.
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 5d8a3a9bd58260..0c2d5f85bf26f3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -48006,8 +48006,8 @@ static SDValue combineAndShuffleNot(SDNode *N, SelectionDAG &DAG,
// given x, y and z are of type \p VT. We can do so, if operands are either
// truncates from VT types, the second operand is a vector of constants or can
// be recursively promoted.
-static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG,
- unsigned Depth) {
+static SDValue PromoteMaskArithmetic(SDValue N, const SDLoc &DL, EVT VT,
+ SelectionDAG &DAG, unsigned Depth) {
// Limit recursion to avoid excessive compile times.
if (Depth >= SelectionDAG::MaxRecursionDepth)
return SDValue();
@@ -48017,13 +48017,12 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG,
SDValue N0 = N.getOperand(0);
SDValue N1 = N.getOperand(1);
- SDLoc DL(N);
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
if (!TLI.isOperationLegalOrPromote(N.getOpcode(), VT))
return SDValue();
- if (SDValue NN0 = PromoteMaskArithmetic(N0, VT, DAG, Depth + 1))
+ if (SDValue NN0 = PromoteMaskArithmetic(N0, DL, VT, DAG, Depth + 1))
N0 = NN0;
else {
// The left side has to be a trunc.
@@ -48037,7 +48036,7 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG,
N0 = N0.getOperand(0);
}
- if (SDValue NN1 = PromoteMaskArithmetic(N1, VT, DAG, Depth + 1))
+ if (SDValue NN1 = PromoteMaskArithmetic(N1, DL, VT, DAG, Depth + 1))
N1 = NN1;
else {
// The right side has to be a 'trunc' or a (foldable) constant.
@@ -48061,12 +48060,11 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG,
// some of the transition sequences.
// Even with AVX-512 this is still useful for removing casts around logical
// operations on vXi1 mask types.
-static SDValue PromoteMaskArithmetic(SDValue N, SelectionDAG &DAG,
+static SDValue PromoteMaskArithmetic(SDValue N, const SDLoc &DL,
+ SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
EVT VT = N.getValueType();
assert(VT.isVector() && "Expected vector type");
-
- SDLoc DL(N);
assert((N.getOpcode() == ISD::ANY_EXTEND ||
N.getOpcode() == ISD::ZERO_EXTEND ||
N.getOpcode() == ISD::SIGN_EXTEND) && "Invalid Node");
@@ -48075,7 +48073,7 @@ static SDValue PromoteMaskArithmetic(SDValue N, SelectionDAG &DAG,
EVT NarrowVT = Narrow.getValueType();
// Generate the wide operation.
- SDValue Op = PromoteMaskArithmetic(Narrow, VT, DAG, 0);
+ SDValue Op = PromoteMaskArithmetic(Narrow, DL, VT, DAG, 0);
if (!Op)
return SDValue();
switch (N.getOpcode()) {
@@ -52549,7 +52547,7 @@ static SDValue combineSignExtendInReg(SDNode *N, SelectionDAG &DAG,
// Attempt to promote any comparison mask ops before moving the
// SIGN_EXTEND_INREG in the way.
- if (SDValue Promote = PromoteMaskArithmetic(N0, DAG, Subtarget))
+ if (SDValue Promote = PromoteMaskArithmetic(N0, dl, DAG, Subtarget))
return DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, VT, Promote, N1);
if (N00.getValueType() == MVT::v4i32 && ExtraVT.getSizeInBits() < 128) {
@@ -52770,7 +52768,7 @@ static SDValue combineSext(SDNode *N, SelectionDAG &DAG,
return V;
if (VT.isVector()) {
- if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget))
+ if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DL, DAG, Subtarget))
return R;
if (N0.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG)
@@ -52984,7 +52982,7 @@ static SDValue combineZext(SDNode *N, SelectionDAG &DAG,
return V;
if (VT.isVector())
- if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget))
+ if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), dl, DAG, Subtarget))
return R;
if (SDValue NewAdd = promoteExtBeforeAdd(N, DAG, Subtarget))
More information about the llvm-commits
mailing list