Skip to content

Commit 81d57fc

Browse files
committed
Use std::array
1 parent 8621324 commit 81d57fc

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

llvm/include/llvm/Analysis/VectorUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ bool getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
210210
/// will be matched a slide by 0. The output parameter provides the source
211211
/// (-1 means no source), and slide direction for each slide.
212212
bool isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
213-
std::pair<int, int> SrcInfo[2]);
213+
std::array<std::pair<int, int>, 2> &SrcInfo);
214214

215215
/// Replace each shuffle mask index with the scaled sequential indices for an
216216
/// equivalent mask of narrowed elements. Mask elements that are less than 0

llvm/lib/Analysis/VectorUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ bool llvm::getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
414414
}
415415

416416
bool llvm::isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
417-
std::pair<int, int> SrcInfo[2]) {
417+
std::array<std::pair<int, int>, 2> &SrcInfo) {
418418
const int SignalValue = NumElts * 2;
419419
SrcInfo[0] = {-1, SignalValue};
420420
SrcInfo[1] = {-1, SignalValue};

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4562,7 +4562,7 @@ static bool isInterleaveShuffle(ArrayRef<int> Mask, MVT VT, int &EvenSrc,
45624562

45634563
/// Is this mask representing a masked combination of two slides?
45644564
static bool isMaskedSlidePair(ArrayRef<int> Mask,
4565-
std::pair<int, int> SrcInfo[2]) {
4565+
std::array<std::pair<int, int>, 2> &SrcInfo) {
45664566
if (!llvm::isMaskedSlidePair(Mask, Mask.size(), SrcInfo))
45674567
return false;
45684568

@@ -4580,7 +4580,8 @@ static bool isMaskedSlidePair(ArrayRef<int> Mask,
45804580

45814581
// Exactly matches the semantics of a previously existing custom matcher
45824582
// to allow migration to new matcher without changing output.
4583-
static bool isElementRotate(std::pair<int, int> SrcInfo[2], unsigned NumElts) {
4583+
static bool isElementRotate(std::array<std::pair<int, int>, 2> &SrcInfo,
4584+
unsigned NumElts) {
45844585
if (SrcInfo[1].first == -1)
45854586
return true;
45864587
return SrcInfo[0].second < 0 && SrcInfo[1].second > 0 &&
@@ -5581,7 +5582,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
55815582
// without masking. Avoid matching bit rotates (which are not also element
55825583
// rotates) as slide pairs. This is a performance heuristic, not a
55835584
// functional check.
5584-
std::pair<int, int> SrcInfo[2];
5585+
std::array<std::pair<int, int>, 2> SrcInfo;
55855586
unsigned RotateAmt;
55865587
MVT RotateVT;
55875588
if (::isMaskedSlidePair(Mask, SrcInfo) &&
@@ -5941,7 +5942,7 @@ bool RISCVTargetLowering::isShuffleMaskLegal(ArrayRef<int> M, EVT VT) const {
59415942
if (SVT.getScalarType() == MVT::i1)
59425943
return false;
59435944

5944-
std::pair<int, int> SrcInfo[2];
5945+
std::array<std::pair<int, int>, 2> SrcInfo;
59455946
int Dummy1, Dummy2;
59465947
return ShuffleVectorInst::isReverseMask(M, NumElts) ||
59475948
(::isMaskedSlidePair(M, SrcInfo) &&

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
500500
return IsVI ? RISCV::VSLIDEUP_VI : RISCV::VSLIDEUP_VX;
501501
};
502502

503-
std::pair<int, int> SrcInfo[2];
503+
std::array<std::pair<int, int>, 2> SrcInfo;
504504
if (!isMaskedSlidePair(Mask, NumElts, SrcInfo))
505505
return InstructionCost::getInvalid();
506506

0 commit comments

Comments
 (0)