[llvm] [ProfileData] Remove an unnecessary cast (NFC) (PR #150472)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 24 10:15:11 PDT 2025


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

getBufferEnd() already returns const char *.


>From ee787ffcb270289713f4a1fea4a0fb8c0cb3dba6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 23 Jul 2025 23:30:44 -0700
Subject: [PATCH] [ProfileData] Remove an unnecessary cast (NFC)

getBufferEnd() already returns const char *.
---
 llvm/lib/ProfileData/InstrProfReader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 5c7b9e0544030..886add7131da2 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1295,7 +1295,7 @@ Error IndexedInstrProfReader::readHeader() {
     // Writer first writes the length of compressed string, and then the actual
     // content.
     const char *VTableNamePtr = (const char *)Ptr;
-    if (VTableNamePtr > (const char *)DataBuffer->getBufferEnd())
+    if (VTableNamePtr > DataBuffer->getBufferEnd())
       return make_error<InstrProfError>(instrprof_error::truncated);
 
     VTableName = StringRef(VTableNamePtr, CompressedVTableNamesLen);



More information about the llvm-commits mailing list