[llvm] [ARM] Remove a redundant call to StringRef::slice (NFC) (PR #113783)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 26 19:37:12 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113783

OptStr.slice(0, OptStr.size()) is exactly the same as OptStr.


>From d57df4fd309946391f268d210f885577d5496418 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 26 Oct 2024 19:30:58 -0700
Subject: [PATCH] [ARM] Remove a redundant call to StringRef::slice (NFC)

OptStr.slice(0, OptStr.size()) is exactly the same as OptStr.
---
 llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 68f1199fd12e14..0df1c336a22146 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5080,7 +5080,7 @@ ParseStatus ARMAsmParser::parseMemBarrierOptOperand(OperandVector &Operands) {
   if (Tok.is(AsmToken::Identifier)) {
     StringRef OptStr = Tok.getString();
 
-    Opt = StringSwitch<unsigned>(OptStr.slice(0, OptStr.size()).lower())
+    Opt = StringSwitch<unsigned>(OptStr.lower())
               .Case("sy", ARM_MB::SY)
               .Case("st", ARM_MB::ST)
               .Case("ld", ARM_MB::LD)



More information about the llvm-commits mailing list