[compiler-rt] [compiler-rt][ctx_instr] Add `ctx_profile` component (PR #89304)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 13:20:42 PDT 2024


================
@@ -0,0 +1,38 @@
+//===- CtxInstrProfiling.cpp - contextual instrumented PGO000000 ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "CtxInstrProfiling.h"
+#include "sanitizer_common/sanitizer_allocator_internal.h"
+#include "sanitizer_common/sanitizer_common.h"
+#include "sanitizer_common/sanitizer_dense_map.h"
+#include "sanitizer_common/sanitizer_mutex.h"
+#include "sanitizer_common/sanitizer_placement_new.h"
+#include "sanitizer_common/sanitizer_thread_safety.h"
+
+#include <assert.h>
+
+using namespace __ctx_profile;
+
+Arena *Arena::allocateNewArena(size_t Size, Arena *Prev) {
----------------
vitalybuka wrote:

If so, and you are using just InternalAlloc, I'd recommed to switch to malloc() or mmap().
At leaset in google we never link sanitizer_common in prod, only preprod.
Also it will reduce future linking issues if we need to test this with ubsan, or other sanitizer together,


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


More information about the llvm-commits mailing list