Skip to content

Commit 75ba05b

Browse files
author
Aidan
committed
m_mask by ref, m_specmask by value
1 parent dea262c commit 75ba05b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

llvm/include/llvm/CodeGen/SDPatternMatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ template <typename T0, typename T1, typename T2> struct SDShuffle_match {
566566
}
567567
};
568568
struct m_Mask {
569-
ArrayRef<int> MaskRef;
570-
m_Mask(ArrayRef<int> MaskRef) : MaskRef(MaskRef) {}
569+
ArrayRef<int> &MaskRef;
570+
m_Mask(ArrayRef<int> &MaskRef) : MaskRef(MaskRef) {}
571571
bool match(ArrayRef<int> Mask) {
572572
MaskRef = Mask;
573573
return true;

llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ TEST_F(SelectionDAGPatternMatchTest, matchVecShuffle) {
125125
auto VInt32VT = EVT::getVectorVT(Context, Int32VT, 4);
126126
const std::array<int, 4> MaskData = {2, 0, 3, 1};
127127
const std::array<int, 4> OtherMaskData = {1, 2, 3, 4};
128-
ArrayRef<int> CapturedMask(MaskData);
128+
ArrayRef<int> Mask;
129+
ArrayRef<int> OtherMask;
129130

130131
SDValue V0 = DAG->getCopyFromReg(DAG->getEntryNode(), DL, 1, VInt32VT);
131132
SDValue V1 = DAG->getCopyFromReg(DAG->getEntryNode(), DL, 2, VInt32VT);
@@ -135,15 +136,15 @@ TEST_F(SelectionDAGPatternMatchTest, matchVecShuffle) {
135136
using namespace SDPatternMatch;
136137
EXPECT_TRUE(sd_match(VecShuffleWithMask, m_Shuffle(m_Value(), m_Value())));
137138
EXPECT_TRUE(sd_match(VecShuffleWithMask,
138-
m_Shuffle(m_Value(), m_Value(), m_Mask(CapturedMask))));
139+
m_Shuffle(m_Value(), m_Value(), m_Mask(Mask))));
139140
EXPECT_TRUE(
140141
sd_match(VecShuffleWithMask,
141142
m_Shuffle(m_Value(), m_Value(), m_SpecificMask(MaskData))));
142143
EXPECT_FALSE(
143144
sd_match(VecShuffleWithMask,
144145
m_Shuffle(m_Value(), m_Value(), m_SpecificMask(OtherMaskData))));
145-
EXPECT_TRUE(std::equal(MaskData.begin(), MaskData.end(), CapturedMask.begin(),
146-
CapturedMask.end()));
146+
EXPECT_TRUE(
147+
std::equal(MaskData.begin(), MaskData.end(), Mask.begin(), Mask.end()));
147148
}
148149

149150
TEST_F(SelectionDAGPatternMatchTest, matchTernaryOp) {

0 commit comments

Comments
 (0)