diff options
author | Min-Yih Hsu <min.hsu@sifive.com> | 2024-12-26 09:09:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-26 09:09:02 -0800 |
commit | d21f300f06d56a46e96d1e594522ab0ac362f074 (patch) | |
tree | 1da59d4f8d0ffaa0d62fa975425b233bb5c6338e /llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp | |
parent | 4a92c27f9d29d065156647f9bcc44a8418c98efa (diff) | |
download | llvm-d21f300f06d56a46e96d1e594522ab0ac362f074.zip llvm-d21f300f06d56a46e96d1e594522ab0ac362f074.tar.gz llvm-d21f300f06d56a46e96d1e594522ab0ac362f074.tar.bz2 |
[MIPatternMatch] Fix incorrect argument type of m_Type (#121074)
m_Type is supposed to extract the underlying value type (equality type
comparison is covered by m_SpecificType), therefore it should take a LLT
reference as its argument rather than passing by value.
This was originated from de256478e61d6488db751689af82d280ba114a6f, which
refactored out a good chunk of LLT reference usages. And it's just so
happen that (for some reasons) no one is using m_Type and no test was
covering it.
Diffstat (limited to 'llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp')
-rw-r--r-- | llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp index 59a86fa..bcaa321 100644 --- a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp +++ b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp @@ -576,6 +576,11 @@ TEST_F(AArch64GISelMITest, MatchMiscellaneous) { auto MIBAdd = B.buildAdd(s64, Copies[0], Copies[1]); Register Reg = MIBAdd.getReg(0); + // Extract the type. + LLT Ty; + EXPECT_TRUE(mi_match(Reg, *MRI, m_GAdd(m_Type(Ty), m_Reg()))); + EXPECT_EQ(Ty, s64); + // Only one use of Reg. B.buildCast(LLT::pointer(0, 32), MIBAdd); EXPECT_TRUE(mi_match(Reg, *MRI, m_OneUse(m_GAdd(m_Reg(), m_Reg())))); |