[llvm] eb2aba4 - [RISCV] Remove extra call to MatchRegisterName in parseRegListCommon. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 31 21:56:06 PDT 2025


Author: Craig Topper
Date: 2025-03-31T21:55:24-07:00
New Revision: eb2aba4a648c055533db10f5348e483ead4561ec

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

LOG: [RISCV] Remove extra call to MatchRegisterName in parseRegListCommon. NFC

Update RegEnd after each call to MatchRegisterName end of calling it
again.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 63d0777e4ff52..c1670326143e3 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2636,7 +2636,8 @@ ParseStatus RISCVAsmParser::parseRegListCommon(OperandVector &Operands,
       if (getLexer().isNot(AsmToken::Identifier))
         return Error(getLoc(), "invalid register");
       StringRef EndName = getLexer().getTok().getIdentifier();
-      if (MatchRegisterName(EndName) != RISCV::X18)
+      RegEnd = MatchRegisterName(EndName);
+      if (RegEnd != RISCV::X18)
         return Error(getLoc(),
                      "second contiguous registers pair of register list "
                      "must start from 'x18'");
@@ -2647,11 +2648,11 @@ ParseStatus RISCVAsmParser::parseRegListCommon(OperandVector &Operands,
         if (getLexer().isNot(AsmToken::Identifier))
           return Error(getLoc(), "invalid register");
         EndName = getLexer().getTok().getIdentifier();
-        if (!MatchRegisterName(EndName))
+        RegEnd = MatchRegisterName(EndName);
+        if (!RegEnd)
           return Error(getLoc(), "invalid register");
         getLexer().Lex();
       }
-      RegEnd = MatchRegisterName(EndName);
     }
   }
 


        


More information about the llvm-commits mailing list