[llvm] 9ad78b0 - [Lanai] Use StringRef::consume_back (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 3 09:36:57 PST 2024


Author: Kazu Hirata
Date: 2024-02-03T09:36:47-08:00
New Revision: 9ad78b0994a2a1d7c28f463a89585a0ffd5310e4

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

LOG: [Lanai] Use StringRef::consume_back (NFC)

Added: 
    

Modified: 
    llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp b/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
index d0a89ad72b4c0..f875cee9a9b3c 100644
--- a/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
+++ b/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
@@ -1047,11 +1047,7 @@ StringRef LanaiAsmParser::splitMnemonic(StringRef Name, SMLoc NameLoc,
 
   StringRef Mnemonic = Name;
 
-  bool IsBRR = false;
-  if (Name.ends_with(".r")) {
-    Mnemonic = Name.substr(0, Name.size() - 2);
-    IsBRR = true;
-  }
+  bool IsBRR = Mnemonic.consume_back(".r");
 
   // Match b?? and s?? (BR, BRR, and SCC instruction classes).
   if (Mnemonic[0] == 'b' ||


        


More information about the llvm-commits mailing list