diff options
author | Manman Ren <manman.ren@gmail.com> | 2019-03-05 01:21:40 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2019-03-05 01:21:40 +0000 |
commit | f4bdc161222c5769fb0e2a5b6e9fb24962d1e08f (patch) | |
tree | 6308fe213e06ac2686dfc279296d681559847e77 /lib/profile | |
parent | 229545b10452bb1e81f76494a2e77e031fcc91f4 (diff) | |
download | compiler-rt-f4bdc161222c5769fb0e2a5b6e9fb24962d1e08f.tar.gz |
Revert compiler-rt diffs for order file instrumentation to get bot green!
This caused issues on Linux/Windows and other platforms.
r355343 355350 355350
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile')
-rw-r--r-- | lib/profile/InstrProfData.inc | 22 | ||||
-rw-r--r-- | lib/profile/InstrProfiling.h | 4 | ||||
-rw-r--r-- | lib/profile/InstrProfilingFile.c | 86 | ||||
-rw-r--r-- | lib/profile/InstrProfilingPlatformDarwin.c | 5 | ||||
-rw-r--r-- | lib/profile/InstrProfilingPlatformLinux.c | 5 | ||||
-rw-r--r-- | lib/profile/InstrProfilingPlatformOther.c | 4 | ||||
-rw-r--r-- | lib/profile/InstrProfilingPlatformWindows.c | 3 |
7 files changed, 0 insertions, 129 deletions
diff --git a/lib/profile/InstrProfData.inc b/lib/profile/InstrProfData.inc index 8a3855b39..19d465129 100644 --- a/lib/profile/InstrProfData.inc +++ b/lib/profile/InstrProfData.inc @@ -265,9 +265,6 @@ INSTR_PROF_SECT_ENTRY(IPSK_vnodes, \ INSTR_PROF_SECT_ENTRY(IPSK_covmap, \ INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_COMMON), \ INSTR_PROF_COVMAP_COFF, "__LLVM_COV,") -INSTR_PROF_SECT_ENTRY(IPSK_orderfile, \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON), \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COFF), "__DATA,") #undef INSTR_PROF_SECT_ENTRY #endif @@ -659,7 +656,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, #define INSTR_PROF_VALS_COMMON __llvm_prf_vals #define INSTR_PROF_VNODES_COMMON __llvm_prf_vnds #define INSTR_PROF_COVMAP_COMMON __llvm_covmap -#define INSTR_PROF_ORDERFILE_COMMON __llvm_orderfile /* Windows section names. Because these section names contain dollar characters, * they must be quoted. */ @@ -669,7 +665,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, #define INSTR_PROF_VALS_COFF ".lprfv$M" #define INSTR_PROF_VNODES_COFF ".lprfnd$M" #define INSTR_PROF_COVMAP_COFF ".lcovmap$M" -#define INSTR_PROF_ORDERFILE_COFF ".lorderfile$M" #ifdef _WIN32 /* Runtime section names and name strings. */ @@ -683,7 +678,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, /* Value profile nodes section. */ #define INSTR_PROF_VNODES_SECT_NAME INSTR_PROF_VNODES_COFF #define INSTR_PROF_COVMAP_SECT_NAME INSTR_PROF_COVMAP_COFF -#define INSTR_PROF_ORDERFILE_SECT_NAME INSTR_PROF_ORDERFILE_COFF #else /* Runtime section names and name strings. */ #define INSTR_PROF_DATA_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_DATA_COMMON) @@ -696,18 +690,8 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, /* Value profile nodes section. */ #define INSTR_PROF_VNODES_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_VNODES_COMMON) #define INSTR_PROF_COVMAP_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_COMMON) -/* Order file instrumentation. */ -#define INSTR_PROF_ORDERFILE_SECT_NAME \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON) #endif -#define INSTR_PROF_ORDERFILE_BUFFER_NAME _llvm_order_file_buffer -#define INSTR_PROF_ORDERFILE_BUFFER_NAME_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_NAME) -#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME _llvm_order_file_buffer_idx -#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME) - /* Macros to define start/stop section symbol for a given * section on Linux. For instance * INSTR_PROF_SECT_START(INSTR_PROF_DATA_SECT_NAME) will @@ -741,12 +725,6 @@ typedef struct InstrProfValueData { #endif /* INSTR_PROF_DATA_INC */ -#ifndef INSTR_ORDER_FILE_INC -// The maximal # of functions: 128*1024 (the buffer size will be 128*4 KB). -#define INSTR_ORDER_FILE_BUFFER_SIZE 131072 -#define INSTR_ORDER_FILE_BUFFER_BITS 17 -#define INSTR_ORDER_FILE_BUFFER_MASK 0x1ffff -#endif /* INSTR_ORDER_FILE_INC */ #else #undef INSTR_PROF_DATA_DEFINED #endif diff --git a/lib/profile/InstrProfiling.h b/lib/profile/InstrProfiling.h index 857cff4b3..0f9565adc 100644 --- a/lib/profile/InstrProfiling.h +++ b/lib/profile/InstrProfiling.h @@ -64,7 +64,6 @@ uint64_t *__llvm_profile_begin_counters(void); uint64_t *__llvm_profile_end_counters(void); ValueProfNode *__llvm_profile_begin_vnodes(); ValueProfNode *__llvm_profile_end_vnodes(); -uint32_t *__llvm_profile_begin_orderfile(); /*! * \brief Clear profile counters to zero. @@ -121,7 +120,6 @@ void __llvm_profile_instrument_target_value(uint64_t TargetValue, void *Data, */ int __llvm_profile_write_file(void); -int __llvm_orderfile_write_file(void); /*! * \brief this is a wrapper interface to \c __llvm_profile_write_file. * After this interface is invoked, a arleady dumped flag will be set @@ -144,8 +142,6 @@ int __llvm_orderfile_write_file(void); */ int __llvm_profile_dump(void); -int __llvm_orderfile_dump(void); - /*! * \brief Set the filename for writing instrumentation data. * diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index 8c32bde9d..99b138b2d 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -111,15 +111,6 @@ static uint32_t fileWriter(ProfDataWriter *This, ProfDataIOVec *IOVecs, return 0; } -/* TODO: make buffer size controllable by an internal option, and compiler can pass the size - to runtime via a variable. */ -static uint32_t orderFileWriter(FILE *File, const uint32_t *DataStart) { - if (fwrite(DataStart, sizeof(uint32_t), INSTR_ORDER_FILE_BUFFER_SIZE, File) != - INSTR_ORDER_FILE_BUFFER_SIZE) - return 1; - return 0; -} - static void initFileWriter(ProfDataWriter *This, FILE *File) { This->Write = fileWriter; This->WriterCtx = File; @@ -269,27 +260,6 @@ static int writeFile(const char *OutputName) { return RetVal; } -/* Write order data to file \c OutputName. */ -static int writeOrderFile(const char *OutputName) { - int RetVal; - FILE *OutputFile; - - OutputFile = fopen(OutputName, "w"); - - if (!OutputFile) { - PROF_WARN("can't open file with mode ab: %s\n", OutputName); - return -1; - } - - FreeHook = &free; - setupIOBuffer(); - const uint32_t *DataBegin = __llvm_profile_begin_orderfile(); - RetVal = orderFileWriter(OutputFile, DataBegin); - - fclose(OutputFile); - return RetVal; -} - static void truncateCurrentFile(void) { const char *Filename; char *FilenameBuf; @@ -678,62 +648,6 @@ int __llvm_profile_dump(void) { return rc; } -/* Order file data will be saved in a file with suffx .order. */ -static const char *OrderFileSuffix = ".order"; - -COMPILER_RT_VISIBILITY -int __llvm_orderfile_write_file(void) { - int rc, Length, LengthBeforeAppend, SuffixLength; - const char *Filename; - char *FilenameBuf; - int PDeathSig = 0; - - SuffixLength = strlen(OrderFileSuffix); - Length = getCurFilenameLength() + SuffixLength; - FilenameBuf = (char *)COMPILER_RT_ALLOCA(Length + 1); - Filename = getCurFilename(FilenameBuf, 1); - - /* Check the filename. */ - if (!Filename) { - PROF_ERR("Failed to write file : %s\n", "Filename not set"); - return -1; - } - - /* Append order file suffix */ - LengthBeforeAppend = strlen(Filename); - memcpy(FilenameBuf + LengthBeforeAppend, OrderFileSuffix, SuffixLength); - FilenameBuf[LengthBeforeAppend + SuffixLength] = '\0'; - - /* Check if there is llvm/runtime version mismatch. */ - if (GET_VERSION(__llvm_profile_get_version()) != INSTR_PROF_RAW_VERSION) { - PROF_ERR("Runtime and instrumentation version mismatch : " - "expected %d, but get %d\n", - INSTR_PROF_RAW_VERSION, - (int)GET_VERSION(__llvm_profile_get_version())); - return -1; - } - - // Temporarily suspend getting SIGKILL when the parent exits. - PDeathSig = lprofSuspendSigKill(); - - /* Write order data to the file. */ - rc = writeOrderFile(Filename); - if (rc) - PROF_ERR("Failed to write file \"%s\": %s\n", Filename, strerror(errno)); - - // Restore SIGKILL. - if (PDeathSig == 1) - lprofRestoreSigKill(); - - return rc; -} - -COMPILER_RT_VISIBILITY -int __llvm_orderfile_dump(void) { - int rc = __llvm_orderfile_write_file(); - return rc; -} - static void writeFileWithoutReturn(void) { __llvm_profile_write_file(); } COMPILER_RT_VISIBILITY diff --git a/lib/profile/InstrProfilingPlatformDarwin.c b/lib/profile/InstrProfilingPlatformDarwin.c index 23bdb7f37..6eae73fdc 100644 --- a/lib/profile/InstrProfilingPlatformDarwin.c +++ b/lib/profile/InstrProfilingPlatformDarwin.c @@ -27,9 +27,6 @@ extern uint64_t COMPILER_RT_VISIBILITY extern uint64_t CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME); -COMPILER_RT_VISIBILITY -extern uint32_t - OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME); COMPILER_RT_VISIBILITY extern ValueProfNode @@ -52,8 +49,6 @@ COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; } COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } -COMPILER_RT_VISIBILITY -uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; } COMPILER_RT_VISIBILITY ValueProfNode *__llvm_profile_begin_vnodes(void) { diff --git a/lib/profile/InstrProfilingPlatformLinux.c b/lib/profile/InstrProfilingPlatformLinux.c index 1dc15784b..33a737e63 100644 --- a/lib/profile/InstrProfilingPlatformLinux.c +++ b/lib/profile/InstrProfilingPlatformLinux.c @@ -19,7 +19,6 @@ #define PROF_NAME_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_NAME_COMMON) #define PROF_CNTS_START INSTR_PROF_SECT_START(INSTR_PROF_CNTS_COMMON) #define PROF_CNTS_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_CNTS_COMMON) -#define PROF_ORDERFILE_START INSTR_PROF_SECT_START(INSTR_PROF_ORDERFILE_COMMON) #define PROF_VNODES_START INSTR_PROF_SECT_START(INSTR_PROF_VNODES_COMMON) #define PROF_VNODES_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_VNODES_COMMON) @@ -30,7 +29,6 @@ extern __llvm_profile_data PROF_DATA_START COMPILER_RT_VISIBILITY; extern __llvm_profile_data PROF_DATA_STOP COMPILER_RT_VISIBILITY; extern uint64_t PROF_CNTS_START COMPILER_RT_VISIBILITY; extern uint64_t PROF_CNTS_STOP COMPILER_RT_VISIBILITY; -extern uint32_t PROF_ORDERFILE_START COMPILER_RT_VISIBILITY; extern char PROF_NAME_START COMPILER_RT_VISIBILITY; extern char PROF_NAME_STOP COMPILER_RT_VISIBILITY; extern ValueProfNode PROF_VNODES_START COMPILER_RT_VISIBILITY; @@ -64,9 +62,6 @@ COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_begin_counters(void) { COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_end_counters(void) { return &PROF_CNTS_STOP; } -COMPILER_RT_VISIBILITY uint32_t *__llvm_profile_begin_orderfile(void) { - return &PROF_ORDERFILE_START; -} COMPILER_RT_VISIBILITY ValueProfNode * __llvm_profile_begin_vnodes(void) { diff --git a/lib/profile/InstrProfilingPlatformOther.c b/lib/profile/InstrProfilingPlatformOther.c index 56c5d8378..6cb17aad5 100644 --- a/lib/profile/InstrProfilingPlatformOther.c +++ b/lib/profile/InstrProfilingPlatformOther.c @@ -21,7 +21,6 @@ static const char *NamesFirst = NULL; static const char *NamesLast = NULL; static uint64_t *CountersFirst = NULL; static uint64_t *CountersLast = NULL; -static uint32_t *OrderFileFirst = NULL; static const void *getMinAddr(const void *A1, const void *A2) { return A1 < A2 ? A1 : A2; @@ -83,9 +82,6 @@ COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_begin_counters(void) { return CountersFirst; } COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_end_counters(void) { return CountersLast; } -/* TODO: correctly set up OrderFileFirst. */ -COMPILER_RT_VISIBILITY -uint32_t *__llvm_profile_begin_orderfile(void) { return OrderFileFirst; } COMPILER_RT_VISIBILITY ValueProfNode *__llvm_profile_begin_vnodes(void) { diff --git a/lib/profile/InstrProfilingPlatformWindows.c b/lib/profile/InstrProfilingPlatformWindows.c index 81b708bb2..594e39457 100644 --- a/lib/profile/InstrProfilingPlatformWindows.c +++ b/lib/profile/InstrProfilingPlatformWindows.c @@ -29,7 +29,6 @@ #pragma section(".lprfd$Z", read, write) #pragma section(".lprfc$A", read, write) #pragma section(".lprfc$Z", read, write) -#pragma section(".lorderfile$A", read, write) #pragma section(".lprfnd$A", read, write) #pragma section(".lprfnd$Z", read, write) #endif @@ -42,7 +41,6 @@ const char COMPILER_RT_SECTION(".lprfn$Z") NamesEnd = '\0'; uint64_t COMPILER_RT_SECTION(".lprfc$A") CountersStart; uint64_t COMPILER_RT_SECTION(".lprfc$Z") CountersEnd; -uint32_t COMPILER_RT_SECTION(".lorderfile$A") OrderFileStart; ValueProfNode COMPILER_RT_SECTION(".lprfnd$A") VNodesStart; ValueProfNode COMPILER_RT_SECTION(".lprfnd$Z") VNodesEnd; @@ -57,7 +55,6 @@ const char *__llvm_profile_end_names(void) { return &NamesEnd; } uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart + 1; } uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } -uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; } ValueProfNode *__llvm_profile_begin_vnodes(void) { return &VNodesStart + 1; } ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; } |