[PATCH] D146113: [RISCV] Make RISCVISAInfo::toFeatureVector ignore unsupported extensions

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 07:52:22 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf602edf0ecb: [RISCV] Make RISCVISAInfo::toFeatureVector ignore unsupported extensions (authored by asb).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146113/new/

https://reviews.llvm.org/D146113

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
@@ -446,3 +446,10 @@
   EXPECT_THAT((*MaybeISAInfo2)->toFeatureVector(),
               ElementsAre("+e", "+experimental-zihintntl", "+xventanacondops"));
 }
+
+TEST(ToFeatureVector, UnsupportedExtensionsAreDropped) {
+  auto MaybeISAInfo =
+      RISCVISAInfo::parseNormalizedArchString("rv64i2p0_m2p0_xmadeup1p0");
+  ASSERT_THAT_EXPECTED(MaybeISAInfo, Succeeded());
+  EXPECT_THAT((*MaybeISAInfo)->toFeatureVector(), ElementsAre("+m"));
+}
Index: llvm/lib/Support/RISCVISAInfo.cpp
===================================================================
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -1101,6 +1101,8 @@
     std::string ExtName = Ext.first;
     if (ExtName == "i") // i is not recognized in clang -cc1
       continue;
+    if (!isSupportedExtension(ExtName))
+      continue;
     std::string Feature = isExperimentalExtension(ExtName)
                               ? "+experimental-" + ExtName
                               : "+" + ExtName;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146113.508419.patch
Type: text/x-patch
Size: 1208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230326/f9d1b7c2/attachment.bin>


More information about the llvm-commits mailing list