[llvm] [Utils] Use StringRef::ends_with (NFC) (PR #135934)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 00:57:49 PDT 2025


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

None

>From 7735f03f33ede99ad1c233b8892a4d3a78037e6c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 16 Apr 2025 00:46:28 -0700
Subject: [PATCH] [Utils] Use StringRef::ends_with (NFC)

---
 llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 4e37c587dc975..941e787f91eff 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1936,7 +1936,7 @@ static Value *optimizeDoubleFP(CallInst *CI, IRBuilderBase &B,
   bool IsIntrinsic = CalleeFn->isIntrinsic();
   if (!IsIntrinsic) {
     StringRef CallerName = CI->getFunction()->getName();
-    if (!CallerName.empty() && CallerName.back() == 'f' &&
+    if (CallerName.ends_with('f') &&
         CallerName.size() == (CalleeName.size() + 1) &&
         CallerName.starts_with(CalleeName))
       return nullptr;



More information about the llvm-commits mailing list