[compiler-rt] r201808 - Add an environment variable to override the default profile output file.

Bob Wilson bob.wilson at apple.com
Thu Feb 20 11:52:33 PST 2014


Author: bwilson
Date: Thu Feb 20 13:52:32 2014
New Revision: 201808

URL: http://llvm.org/viewvc/llvm-project?rev=201808&view=rev
Log:
Add an environment variable to override the default profile output file.

Also rename the default output file from "pgo-data" to "default.profdata".
The ".profdata" suffix is consistent with the name of the new llvm-profdata
tool.

Modified:
    compiler-rt/trunk/lib/profile/PGOProfiling.c

Modified: compiler-rt/trunk/lib/profile/PGOProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/PGOProfiling.c?rev=201808&r1=201807&r2=201808&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/PGOProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/PGOProfiling.c Thu Feb 20 13:52:32 2014
@@ -56,7 +56,10 @@ void llvm_pgo_register_writeout_function
 }
 
 void llvm_pgo_writeout_files() {
-  OutputFile = fopen("pgo-data", "w");
+  const char *OutputName = getenv("LLVM_PROFILE_FILE");
+  if (OutputName == NULL || OutputName[0] == '\0')
+    OutputName = "default.profdata";
+  OutputFile = fopen(OutputName, "w");
   if (!OutputFile) return;
 
   while (writeout_fn_head) {





More information about the llvm-commits mailing list