[llvm] 7237bef - [RISCV] Use map::count instead of hasExtension in computeDefaultABI. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 12:20:55 PDT 2024


Author: Craig Topper
Date: 2024-05-10T12:20:24-07:00
New Revision: 7237bef5da57e8d67db25df7c22379e81e5903a7

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

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

hasExtension checks if the extension name is a known extension name.
That should always be true for the extensions listed here so we can
skip that check.

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 8ae0c355479ce..931c2aa41ac74 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -998,19 +998,19 @@ RISCVISAInfo::postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo) {
 
 StringRef RISCVISAInfo::computeDefaultABI() const {
   if (XLen == 32) {
-    if (hasExtension("e"))
+    if (Exts.count("e"))
       return "ilp32e";
-    if (hasExtension("d"))
+    if (Exts.count("d"))
       return "ilp32d";
-    if (hasExtension("f"))
+    if (Exts.count("f"))
       return "ilp32f";
     return "ilp32";
   } else if (XLen == 64) {
-    if (hasExtension("e"))
+    if (Exts.count("e"))
       return "lp64e";
-    if (hasExtension("d"))
+    if (Exts.count("d"))
       return "lp64d";
-    if (hasExtension("f"))
+    if (Exts.count("f"))
       return "lp64f";
     return "lp64";
   }


        


More information about the llvm-commits mailing list