[llvm] 1919adb - [RISCV] Fix the problem of parsing long version numbers

Shao-Ce SUN via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 20:48:23 PDT 2022


Author: Shao-Ce SUN
Date: 2022-06-28T11:48:14+08:00
New Revision: 1919adb19b4a0aeaef7f3b75a90062166b58b261

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

LOG: [RISCV] Fix the problem of parsing long version numbers

For example, when parsing Zbpbo0p911, an error will be reported:
"multi-character extensions must be separated by underscores"

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D128644

Added: 
    

Modified: 
    llvm/lib/Support/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 6b2614dbdd4cd..1057dbae13da9 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -348,7 +348,7 @@ static Error getExtensionVersion(StringRef Ext, StringRef In, unsigned &Major,
 
   if (!MajorStr.empty() && In.consume_front("p")) {
     MinorStr = In.take_while(isDigit);
-    In = In.substr(MajorStr.size() + 1);
+    In = In.substr(MajorStr.size() + MinorStr.size() - 1);
 
     // Expected 'p' to be followed by minor version number.
     if (MinorStr.empty()) {


        


More information about the llvm-commits mailing list