[llvm] 4f683b1 - [RISCV] When resolving extension implications, handle the default I/E case after implications are resolved. (#154353)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 18:59:27 PDT 2025


Author: Owen Anderson
Date: 2025-08-20T09:59:23+08:00
New Revision: 4f683b10b5fb4013b60ef5e507695d259a05b4f8

URL: https://github.com/llvm/llvm-project/commit/4f683b10b5fb4013b60ef5e507695d259a05b4f8
DIFF: https://github.com/llvm/llvm-project/commit/4f683b10b5fb4013b60ef5e507695d259a05b4f8.diff

LOG: [RISCV] When resolving extension implications, handle the default I/E case after implications are resolved. (#154353)

This is needed to handle the scenario of an extension that implies
FeatureStdExtE, as is the case for the
downstream FeatureVendorXCheriot used for Cheriot support.

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index d6afb8afd98b4..7617058aa102f 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -833,19 +833,6 @@ static bool operator<(StringRef LHS, const ImpliedExtsEntry &RHS) {
 #include "llvm/TargetParser/RISCVTargetParserDef.inc"
 
 void RISCVISAInfo::updateImplication() {
-  bool HasE = Exts.count("e") != 0;
-  bool HasI = Exts.count("i") != 0;
-
-  // If not in e extension and i extension does not exist, i extension is
-  // implied
-  if (!HasE && !HasI) {
-    auto Version = findDefaultVersion("i");
-    Exts["i"] = *Version;
-  }
-
-  if (HasE && HasI)
-    Exts.erase("i");
-
   assert(llvm::is_sorted(ImpliedExts) && "Table not sorted by Name");
 
   // This loop may execute over 1 iteration since implication can be layered
@@ -887,6 +874,21 @@ void RISCVISAInfo::updateImplication() {
     auto Version = findDefaultVersion("zcf");
     Exts["zcf"] = *Version;
   }
+
+  // Handle I/E after implications have been resolved, in case either
+  // of them was implied by another extension.
+  bool HasE = Exts.count("e") != 0;
+  bool HasI = Exts.count("i") != 0;
+
+  // If not in e extension and i extension does not exist, i extension is
+  // implied
+  if (!HasE && !HasI) {
+    auto Version = findDefaultVersion("i");
+    Exts["i"] = *Version;
+  }
+
+  if (HasE && HasI)
+    Exts.erase("i");
 }
 
 static constexpr StringLiteral CombineIntoExts[] = {


        


More information about the llvm-commits mailing list