[compiler-rt] [compiler-rt][ctx_profile] Add the instrumented contextual profiling APIs (PR #89838)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 16:56:09 PDT 2024
================
@@ -38,3 +131,181 @@ void Arena::freeArenaList(Arena *&A) {
}
A = nullptr;
}
+
+inline ContextNode *ContextNode::alloc(char *Place, GUID Guid,
+ uint32_t NrCounters,
+ uint32_t NrCallsites,
+ ContextNode *Next) {
+ assert(reinterpret_cast<uint64_t>(Place) % sizeof(void *) == 0);
+ return new (Place) ContextNode(Guid, NrCounters, NrCallsites, Next);
+}
+
+void ContextNode::reset() {
+ for (uint32_t I = 0; I < NrCounters; ++I)
+ counters()[I] = 0;
----------------
mtrofin wrote:
__sanitizer::internal_memset is the best we can do. I'm not super-sure we really want that though (would be happy with std::memset) - because see FIXME here about removing more of the deps to sanitizer_common - not that this would be too hard to fix; but also don't we have a pass in LLVM that would effectivelly recognize this as memset and replace with the intrinsic? I.e. may not achieve much.
Left a FIXME to do std::memset though.
https://github.com/llvm/llvm-project/pull/89838
More information about the llvm-commits
mailing list