[PATCH] D145882: [RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 12 11:21:26 PDT 2023
asb created this revision.
asb added reviewers: kito-cheng, MaskRay, jrtc27, reames, craig.topper.
Herald added subscribers: luke, wingo, pmatos, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
asb requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD.
Herald added a project: LLVM.
Prior to this patch, unrecognised z/s/sx/x prefixed extensions were not ignored when IgnoreUnknown=true.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145882
Files:
llvm/lib/Support/RISCVISAInfo.cpp
llvm/unittests/Support/RISCVISAInfoTest.cpp
Index: llvm/unittests/Support/RISCVISAInfoTest.cpp
===================================================================
--- llvm/unittests/Support/RISCVISAInfoTest.cpp
+++ llvm/unittests/Support/RISCVISAInfoTest.cpp
@@ -230,7 +230,8 @@
}
TEST(ParseArchString, IgnoresUnrecognizedExtensionNamesWithIgnoreUnknown) {
- for (StringRef Input : {"rv32ib"}) {
+ for (StringRef Input : {"rv32ib", "rv32i_zmadeup", "rv64i_smadeup",
+ "rv32i_sxmadeup", "rv64i_xmadeup"}) {
auto MaybeISAInfo = RISCVISAInfo::parseArchString(Input, true, false, true);
ASSERT_THAT_EXPECTED(MaybeISAInfo, Succeeded());
RISCVISAInfo &Info = **MaybeISAInfo;
@@ -238,13 +239,6 @@
EXPECT_EQ(Exts.size(), 1UL);
EXPECT_TRUE(Exts.at("i") == (RISCVExtensionInfo{"i", 2, 0}));
}
- // FIXME: These unrecognized extensions should be ignored just as in the
- // case above. The below captures the current (incorrect) behaviour.
- for (StringRef Input :
- {"rv32i_zmadeup", "rv64i_smadeup", "rv32i_sxmadeup", "rv64i_xmadeup"}) {
- auto MaybeISAInfo = RISCVISAInfo::parseArchString(Input, true, false, true);
- EXPECT_THAT_EXPECTED(MaybeISAInfo, Failed());
- }
}
TEST(ParseArchString, AcceptsVersionInLongOrShortForm) {
Index: llvm/lib/Support/RISCVISAInfo.cpp
===================================================================
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -804,6 +804,9 @@
Desc.str().c_str(), Name.str().c_str());
}
+ if (IgnoreUnknown && !isSupportedExtension(Ext))
+ continue;
+
ISAInfo->addExtension(Name, Major, Minor);
// Extension format is correct, keep parsing the extensions.
// TODO: Save Type, Name, Major, Minor to avoid parsing them later.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145882.504459.patch
Type: text/x-patch
Size: 1815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230312/fc99f77f/attachment-0001.bin>
More information about the llvm-commits
mailing list