[PATCH] D12717: Reduce PGO Instrumentation binary and profile data size (Patch-3)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 17:10:11 PDT 2015
davidxl created this revision.
davidxl added reviewers: llvm-commits, bogner, silvas, xur.
See patch-1 for descriptions
http://reviews.llvm.org/D12717
Files:
lib/profile/InstrProfiling.c
lib/profile/InstrProfiling.h
Index: lib/profile/InstrProfiling.h
===================================================================
--- lib/profile/InstrProfiling.h
+++ lib/profile/InstrProfiling.h
@@ -56,6 +56,8 @@
const char *__llvm_profile_end_names(void);
uint64_t *__llvm_profile_begin_counters(void);
uint64_t *__llvm_profile_end_counters(void);
+extern uint64_t __llvm_profile_magic;
+extern uint64_t __llvm_profile_version;
/*!
* \brief Write instrumentation data to the current file.
Index: lib/profile/InstrProfiling.c
===================================================================
--- lib/profile/InstrProfiling.c
+++ lib/profile/InstrProfiling.c
@@ -12,37 +12,17 @@
__attribute__((visibility("hidden")))
uint64_t __llvm_profile_get_magic(void) {
- /* Magic number to detect file format and endianness.
- *
- * Use 255 at one end, since no UTF-8 file can use that character. Avoid 0,
- * so that utilities, like strings, don't grab it as a string. 129 is also
- * invalid UTF-8, and high enough to be interesting.
- *
- * Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR"
- * for 32-bit platforms.
- */
- unsigned char R = sizeof(void *) == sizeof(uint64_t) ? 'r' : 'R';
- return
- (uint64_t)255 << 56 |
- (uint64_t)'l' << 48 |
- (uint64_t)'p' << 40 |
- (uint64_t)'r' << 32 |
- (uint64_t)'o' << 24 |
- (uint64_t)'f' << 16 |
- (uint64_t) R << 8 |
- (uint64_t)129;
+ return __llvm_profile_magic;
}
-__attribute__((visibility("hidden")))
-uint64_t __llvm_profile_get_version(void) {
- /* This should be bumped any time the output format changes. */
- return 1;
+__attribute__((visibility("hidden"))) uint64_t
+ __llvm_profile_get_version(void) {
+ return __llvm_profile_version;
}
-__attribute__((visibility("hidden")))
-void __llvm_profile_reset_counters(void) {
+__attribute__((visibility("hidden"))) void __llvm_profile_reset_counters(void) {
uint64_t *I = __llvm_profile_begin_counters();
uint64_t *E = __llvm_profile_end_counters();
- memset(I, 0, sizeof(uint64_t)*(E - I));
+ memset(I, 0, sizeof(uint64_t) * (E - I));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12717.34284.patch
Type: text/x-patch
Size: 2116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150909/de8a3451/attachment.bin>
More information about the llvm-commits
mailing list