[compiler-rt] c8eb932 - [PGO] Simplify InstrProfilingRuntime.cpp
Wael Yehia via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 22:13:03 PDT 2022
Author: Wael Yehia
Date: 2022-10-28T05:12:46Z
New Revision: c8eb932ce6408e09c739097b325008c10797846d
URL: https://github.com/llvm/llvm-project/commit/c8eb932ce6408e09c739097b325008c10797846d
DIFF: https://github.com/llvm/llvm-project/commit/c8eb932ce6408e09c739097b325008c10797846d.diff
LOG: [PGO] Simplify InstrProfilingRuntime.cpp
Differential Revision: https://reviews.llvm.org/D136192
Added:
Modified:
compiler-rt/lib/profile/InstrProfilingRuntime.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/profile/InstrProfilingRuntime.cpp b/compiler-rt/lib/profile/InstrProfilingRuntime.cpp
index 04f761c6ca726..6b2ce97001735 100644
--- a/compiler-rt/lib/profile/InstrProfilingRuntime.cpp
+++ b/compiler-rt/lib/profile/InstrProfilingRuntime.cpp
@@ -12,21 +12,13 @@ extern "C" {
static int RegisterRuntime() {
__llvm_profile_initialize();
+#ifdef _AIX
+ extern COMPILER_RT_VISIBILITY void *__llvm_profile_keep[];
+ (void)*(void *volatile *)__llvm_profile_keep;
+#endif
return 0;
}
-#ifndef _AIX
/* int __llvm_profile_runtime */
-COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR;
-
-static int Registration = RegisterRuntime();
-#else
-extern COMPILER_RT_VISIBILITY void *__llvm_profile_keep[];
-/* On AIX, when linking with -bcdtors:csect, the variable whose constructor does
- * the registration needs to be explicitly kept, hence we reuse the runtime hook
- * variable to do the registration since it'll be kept via the -u linker flag.
- * Create a volatile reference to __llvm_profile_keep to keep the array alive.*/
-COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR =
- ((void)*(void *volatile *)__llvm_profile_keep, RegisterRuntime());
-#endif
+COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR = RegisterRuntime();
}
More information about the llvm-commits
mailing list