[clang] [CopyProf] Clang frontend and driver integration. (PR #225905)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 03:48:35 PDT 2026


================
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-llvm-passes -fcopyprof -fcopyprof-static-size-threshold=16 %s -o - | FileCheck %s --check-prefix=T16
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-llvm-passes -fcopyprof -fcopyprof-static-size-threshold=8 %s -o - | FileCheck %s --check-prefix=T8
+
+// Asserts that special member functions are annotated depending on whether the object size is above the static size threshold.
+
+struct Small {
+  long a;
+  Small() : a(0) {}
+  Small(const Small &other) : a(other.a) {}
+  Small &operator=(const Small &other) {
+    a = other.a;
+    return *this;
+  }
+  ~Small() {}
+};
+static_assert(sizeof(Small) == 8);
+
+struct Large {
+  long a[2];
----------------
newgre wrote:

I think passing the host target triple on the compile command line is sufficient, but we might need `// REQUIRES: x86-registered-target` in `copyprof.cpp` as the thinLOT test may actually hit the backend which may not be compiled in on a non-x86 buildbot (I think memprof-pgho.cpp does something similar)?

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


More information about the cfe-commits mailing list