[llvm] 7054aa6 - Revert "[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString"

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 04:21:30 PDT 2023


Author: Alex Bradbury
Date: 2023-03-13T11:20:28Z
New Revision: 7054aa6d6d68e59c3ee7d7ce4ab65b9acfe1ef06

URL: https://github.com/llvm/llvm-project/commit/7054aa6d6d68e59c3ee7d7ce4ab65b9acfe1ef06
DIFF: https://github.com/llvm/llvm-project/commit/7054aa6d6d68e59c3ee7d7ce4ab65b9acfe1ef06.diff

LOG: Revert "[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString"

This reverts commit a7313f83b9ca904fade446e000550c69e0887cbf.

Causes a buildbot failure.

Added: 
    

Modified: 
    llvm/lib/Support/RISCVISAInfo.cpp
    llvm/unittests/Support/RISCVISAInfoTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 50bce78448753..8a12744d4b193 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -804,9 +804,6 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
                                  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.

diff  --git a/llvm/unittests/Support/RISCVISAInfoTest.cpp b/llvm/unittests/Support/RISCVISAInfoTest.cpp
index 07e288139ff6b..32b097627d9ec 100644
--- a/llvm/unittests/Support/RISCVISAInfoTest.cpp
+++ b/llvm/unittests/Support/RISCVISAInfoTest.cpp
@@ -230,8 +230,7 @@ TEST(ParseArchString, RejectsUnrecognizedExtensionNamesByDefault) {
 }
 
 TEST(ParseArchString, IgnoresUnrecognizedExtensionNamesWithIgnoreUnknown) {
-  for (StringRef Input : {"rv32ib", "rv32i_zmadeup", "rv64i_smadeup",
-                          "rv32i_sxmadeup", "rv64i_xmadeup"}) {
+  for (StringRef Input : {"rv32ib"}) {
     auto MaybeISAInfo = RISCVISAInfo::parseArchString(Input, true, false, true);
     ASSERT_THAT_EXPECTED(MaybeISAInfo, Succeeded());
     RISCVISAInfo &Info = **MaybeISAInfo;
@@ -239,6 +238,13 @@ TEST(ParseArchString, IgnoresUnrecognizedExtensionNamesWithIgnoreUnknown) {
     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) {


        


More information about the llvm-commits mailing list