From 60e43fa0a2d84de06d5bac153b931844886ded9e Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Thu, 21 Jul 2016 03:38:07 +0000 Subject: [Profile] bug fix: profile dir not recursively created git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276234 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/profile/InstrProfilingFile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/profile/InstrProfilingFile.c') diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index 76d81d064..1b49d6f42 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -236,6 +236,11 @@ static void truncateCurrentFile(void) { __llvm_profile_recursive_mkdir(Copy); } + /* By pass file truncation to allow online raw profile + * merging. */ + if (lprofCurFilename.MergePoolSize) + return; + /* Truncate the file. Later we'll reopen and append. */ File = fopen(Filename, "w"); if (!File) @@ -350,8 +355,7 @@ static void parseAndSetFilename(const char *FilenamePat, getPNSStr(PNS)); } - if (!lprofCurFilename.MergePoolSize) - truncateCurrentFile(); + truncateCurrentFile(); } /* Return buffer length that is required to store the current profile -- cgit v1.2.1