[llvm] 2d2f7c1 - [X86] combineConcatVectorOps - pull out repeated Ops.size() calls. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 03:48:40 PDT 2023
Author: Simon Pilgrim
Date: 2023-08-11T11:46:07+01:00
New Revision: 2d2f7c1333ad1a9587f22c0505ce21d5106b9253
URL: https://github.com/llvm/llvm-project/commit/2d2f7c1333ad1a9587f22c0505ce21d5106b9253
DIFF: https://github.com/llvm/llvm-project/commit/2d2f7c1333ad1a9587f22c0505ce21d5106b9253.diff
LOG: [X86] combineConcatVectorOps - pull out repeated Ops.size() calls. NFCI.
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 400c5c4a9a7ca6..b16c980746d077 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -54333,6 +54333,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
SDValue Op0 = Ops[0];
bool IsSplat = llvm::all_equal(Ops);
+ unsigned NumOps = Ops.size();
// Repeated subvectors.
if (IsSplat &&
@@ -54391,7 +54392,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
// concat(extract_subvector(v0,c0), extract_subvector(v1,c1)) -> vperm2x128.
// Only concat of subvector high halves which vperm2x128 is best at.
// TODO: This should go in combineX86ShufflesRecursively eventually.
- if (VT.is256BitVector() && Ops.size() == 2) {
+ if (VT.is256BitVector() && NumOps == 2) {
SDValue Src0 = peekThroughBitcasts(Ops[0]);
SDValue Src1 = peekThroughBitcasts(Ops[1]);
if (Src0.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
@@ -54435,7 +54436,6 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
return true;
};
- unsigned NumOps = Ops.size();
switch (Op0.getOpcode()) {
case X86ISD::VBROADCAST: {
if (!IsSplat && llvm::all_of(Ops, [](SDValue Op) {
@@ -54791,7 +54791,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
EVT SelVT = Ops[0].getOperand(0).getValueType();
if (SelVT.getVectorElementType() == MVT::i1) {
SelVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1,
- Ops.size() * SelVT.getVectorNumElements());
+ NumOps * SelVT.getVectorNumElements());
if (DAG.getTargetLoweringInfo().isTypeLegal(SelVT))
return DAG.getNode(Op0.getOpcode(), DL, VT,
ConcatSubOperand(SelVT.getSimpleVT(), Ops, 0),
@@ -54801,7 +54801,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
}
[[fallthrough]];
case X86ISD::BLENDV:
- if (!IsSplat && VT.is256BitVector() && Ops.size() == 2 &&
+ if (!IsSplat && VT.is256BitVector() && NumOps == 2 &&
(EltSizeInBits >= 32 || Subtarget.hasInt256()) &&
IsConcatFree(VT, Ops, 1) && IsConcatFree(VT, Ops, 2)) {
EVT SelVT = Ops[0].getOperand(0).getValueType();
@@ -54834,7 +54834,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
if (all_of(Ops, [](SDValue Op) { return getTargetConstantFromNode(Op); })) {
SmallVector<APInt> EltBits;
APInt UndefElts = APInt::getZero(VT.getVectorNumElements());
- for (unsigned I = 0, E = Ops.size(); I != E; ++I) {
+ for (unsigned I = 0; I != NumOps; ++I) {
APInt OpUndefElts;
SmallVector<APInt> OpEltBits;
if (!getTargetConstantBitsFromNode(Ops[I], EltSizeInBits, OpUndefElts,
More information about the llvm-commits
mailing list