Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

new already returns ValueProfData *.

new already returns ValueProfData *.
@llvmbot llvmbot added the PGO Profile Guided Optimizations label Aug 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 5, 2025

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

Changes

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

@kazutakahirata kazutakahirata merged commit cf18e5e into llvm:main Aug 5, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250804_cast_llvm_ProfileData branch August 5, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants