[llvm] 6e83058 - [RISCV] Use an assert insead of a if/else+llvm_unreachable. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 22:50:00 PDT 2024


Author: Craig Topper
Date: 2024-04-29T22:49:46-07:00
New Revision: 6e83058138210ab1e219d04974a071b57b3196e1

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

LOG: [RISCV] Use an assert insead of a if/else+llvm_unreachable. NFC

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 24b774314fea84..aec82a94cf97bc 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -667,11 +667,10 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
     // version since the we don't have clear version scheme for that on
     // ISA spec.
     for (const auto *Ext : RISCVGImplications) {
-      if (auto Version = findDefaultVersion(Ext)) {
-        // Postpone AddExtension until end of this function
-        SeenExtMap[Ext] = {Version->Major, Version->Minor};
-      } else
-        llvm_unreachable("Default extension version not found?");
+      auto Version = findDefaultVersion(Ext);
+      assert(Version && "Default extension version not found?");
+      // Postpone AddExtension until end of this function
+      SeenExtMap[Ext] = {Version->Major, Version->Minor};
     }
   } else {
     // Baseline is `i` or `e`


        


More information about the llvm-commits mailing list