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

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


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

new already returns ValueProfData *.


>From e78f6bff57c187262a4bd11a7759a6296a6611b2 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 4 Aug 2025 07:52:22 -0700
Subject: [PATCH] [ProfileData] Remove an unnecessary cast (NFC)

new already returns ValueProfData *.
---
 llvm/lib/ProfileData/InstrProf.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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;
 }



More information about the llvm-commits mailing list