[Perf-training] Fixing an issue with multi-threading PGO generation

When LIT parallelizes the profraw file generation we need to generate unique temp filenames then clean them up after the driver executes.

llvm-svn: 264021
This commit is contained in:
Chris Bieneman 2016-03-22 02:55:40 +00:00
parent 32e9a32225
commit b6f7efa71f
1 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import argparse
import time import time
import bisect import bisect
import shlex import shlex
import tempfile
test_env = { 'PATH' : os.environ['PATH'] } test_env = { 'PATH' : os.environ['PATH'] }
@ -149,10 +150,12 @@ def cc1(args):
# clear the profile file env, so that we don't generate profdata # clear the profile file env, so that we don't generate profdata
# when capturing the cc1 command # when capturing the cc1 command
handle, profraw_file = tempfile.mkstemp()
os.close(handle)
cc1_env = test_env cc1_env = test_env
cc1_env["LLVM_PROFILE_FILE"] = "driver.prfraw" cc1_env["LLVM_PROFILE_FILE"] = profraw_file
cc1_cmd = get_cc1_command_for_args(cmd, cc1_env) cc1_cmd = get_cc1_command_for_args(cmd, cc1_env)
os.remove("driver.prfraw") os.remove(profraw_file)
subprocess.check_call(cc1_cmd) subprocess.check_call(cc1_cmd)
return 0; return 0;