[llvm] [RISCV] When resolving extension implications, handle the default I/E case after implications are resolved. (PR #154353)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 07:53:24 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Owen Anderson (resistor)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/154353.diff
1 Files Affected:
- (modified) llvm/lib/TargetParser/RISCVISAInfo.cpp (+15-13)
``````````diff
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[] = {
``````````
</details>
https://github.com/llvm/llvm-project/pull/154353
More information about the llvm-commits
mailing list