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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/113783.diff


1 Files Affected:

- (modified) llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (+1-1) 


``````````diff
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)

``````````

</details>


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


More information about the llvm-commits mailing list