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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

getBufferEnd() already returns const char *.


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


1 Files Affected:

- (modified) llvm/lib/ProfileData/InstrProfReader.cpp (+1-1) 


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

``````````

</details>


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


More information about the llvm-commits mailing list