[compiler-rt] r270185 - [profile] PROF_ERR, PROF_WARN

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 22:15:42 PDT 2016


Author: davidxl
Date: Fri May 20 00:15:42 2016
New Revision: 270185

URL: http://llvm.org/viewvc/llvm-project?rev=270185&view=rev
Log:
[profile] PROF_ERR, PROF_WARN

 1) Move common prefix to the macro def
 2) Introduced PROF_WARN
 3) Make error message unconditionally printed out.


Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c
    compiler-rt/trunk/lib/profile/InstrProfilingPort.h
    compiler-rt/trunk/test/profile/instrprof-error.c
    compiler-rt/trunk/test/profile/instrprof-version-mismatch.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=270185&r1=270184&r2=270185&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Fri May 20 00:15:42 2016
@@ -228,13 +228,13 @@ int __llvm_profile_write_file(void) {
   GetEnvHook = &getenv;
   /* Check the filename. */
   if (!__llvm_profile_CurrentFilename) {
-    PROF_ERR("LLVM Profile: Failed to write file : %s\n", "Filename not set");
+    PROF_ERR("Failed to write file : %s\n", "Filename not set");
     return -1;
   }
 
   /* Check if there is llvm/runtime version mismatch.  */
   if (GET_VERSION(__llvm_profile_get_version()) != INSTR_PROF_RAW_VERSION) {
-    PROF_ERR("LLVM Profile: runtime and instrumentation version mismatch : "
+    PROF_ERR("Runtime and instrumentation version mismatch : "
              "expected %d, but get %d\n",
              INSTR_PROF_RAW_VERSION,
              (int)GET_VERSION(__llvm_profile_get_version()));
@@ -244,7 +244,7 @@ int __llvm_profile_write_file(void) {
   /* Write the file. */
   rc = writeFileWithName(__llvm_profile_CurrentFilename);
   if (rc)
-    PROF_ERR("LLVM Profile: Failed to write file \"%s\": %s\n",
+    PROF_ERR("Failed to write file \"%s\": %s\n",
             __llvm_profile_CurrentFilename, strerror(errno));
   return rc;
 }

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPort.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=270185&r1=270184&r2=270185&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPort.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPort.h Fri May 20 00:15:42 2016
@@ -70,8 +70,10 @@
 #endif
 
 #define PROF_ERR(Format, ...)                                                  \
-  if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS"))                 \
-    fprintf(stderr, Format, __VA_ARGS__);
+  fprintf(stderr, "LLVM Profile Error: " Format, __VA_ARGS__);
+
+#define PROF_WARN(Format, ...)                                                 \
+  fprintf(stderr, "LLVM Profile Warning: " Format, __VA_ARGS__);
 
 #if defined(__FreeBSD__)
 

Modified: compiler-rt/trunk/test/profile/instrprof-error.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-error.c?rev=270185&r1=270184&r2=270185&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-error.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-error.c Fri May 20 00:15:42 2016
@@ -1,9 +1,9 @@
 // RUN: %clang_profgen -o %t -O3 %s
-// RUN: env LLVM_PROFILE_FILE=%t/ LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s
+// RUN: env LLVM_PROFILE_FILE=%t/  %run %t 1 2>&1 | FileCheck %s
 
 int main(int argc, const char *argv[]) {
   if (argc < 2)
     return 1;
   return 0;
 }
-// CHECK: LLVM Profile: Failed to write file 
+// CHECK: LLVM Profile Error: Failed to write file 

Modified: compiler-rt/trunk/test/profile/instrprof-version-mismatch.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-version-mismatch.c?rev=270185&r1=270184&r2=270185&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-version-mismatch.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-version-mismatch.c Fri May 20 00:15:42 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_profgen -o %t -O3 %s
-// RUN: env LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s
+// RUN: %run %t 1 2>&1 | FileCheck %s
 
 // override the version variable with a bogus version:
 unsigned long long __llvm_profile_raw_version = 10000;
@@ -8,4 +8,4 @@ int main(int argc, const char *argv[]) {
     return 1;
   return 0;
 }
-// CHECK: LLVM Profile: runtime and instrumentation version mismatch
+// CHECK: LLVM Profile Error: Runtime and instrumentation version mismatch




More information about the llvm-commits mailing list