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

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 22:57:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

new already returns ValueProfData *.


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


1 Files Affected:

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


``````````diff
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index bd3964ce127fd..542572975dc89 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -1160,8 +1160,7 @@ void getValueForSiteInstrProf(const void *R, InstrProfValueData *Dst,
 }
 
 ValueProfData *allocValueProfDataInstrProf(size_t TotalSizeInBytes) {
-  ValueProfData *VD =
-      (ValueProfData *)(new (::operator new(TotalSizeInBytes)) ValueProfData());
+  ValueProfData *VD = new (::operator new(TotalSizeInBytes)) ValueProfData();
   memset(VD, 0, TotalSizeInBytes);
   return VD;
 }

``````````

</details>


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


More information about the llvm-commits mailing list