[llvm] e069bb7 - [RISCV] Use map::count instead of hasExtension in RISCVISAInfo::updateCombination. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 20:24:59 PDT 2024


Author: Craig Topper
Date: 2024-05-09T20:14:44-07:00
New Revision: e069bb7fd85b69abded27b44f33bf40a522ab9b6

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

LOG: [RISCV] Use map::count instead of hasExtension in RISCVISAInfo::updateCombination. NFC

hasExtension check isSupportedExtension before the map lookup. All
of the extensions we check for in updateCombination should be valid
extension names so we can bypass that to save some time.

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index c553e330a878b..975cb5897b760 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -890,7 +890,7 @@ void RISCVISAInfo::updateCombination() {
   do {
     MadeChange = false;
     for (StringRef CombineExt : CombineIntoExts) {
-      if (hasExtension(CombineExt))
+      if (Exts.count(CombineExt.str()))
         continue;
 
       // Look up the extension in the ImpliesExt table to find everything it
@@ -899,7 +899,7 @@ void RISCVISAInfo::updateCombination() {
                                     std::end(ImpliedExts), CombineExt);
       bool HasAllRequiredFeatures = std::all_of(
           Range.first, Range.second, [&](const ImpliedExtsEntry &Implied) {
-            return hasExtension(Implied.ImpliedExt);
+            return Exts.count(Implied.ImpliedExt);
           });
       if (HasAllRequiredFeatures) {
         auto Version = findDefaultVersion(CombineExt);


        


More information about the llvm-commits mailing list