[PATCH] D136192: [AIX][PGO] WIP

wael yehia via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 08:53:20 PDT 2022


w2yehia added inline comments.


================
Comment at: compiler-rt/lib/profile/InstrProfilingRuntime.cpp:16
 
-namespace {
-
 class RegisterRuntime {
 public:
----------------
hubert.reinterpretcast wrote:
> The class still needs to be in an unnamed namespace for the constructor to not clash with a user-defined class with the same name.
yes, i had a follow up patch that I was testing on both linux and AIX that gets rid of the class all together:
```
-namespace {
-
-class RegisterRuntime {
-public:
-  RegisterRuntime() {
-    __llvm_profile_initialize();
-  }
-};
-
-RegisterRuntime Registration;
-
+static int RegisterRuntime() {
+  __llvm_profile_initialize();
+  return 0;
 }
+
+#ifdef _AIX
+COMPILER_RT_VISIBILITY
+#else
+static
+#endif
+int __llvm_register_runtime = RegisterRuntime();
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136192/new/

https://reviews.llvm.org/D136192



More information about the llvm-commits mailing list