[compiler-rt] a77a739 - [profile] Suppress spurious 'expected profile to require unlock' warning

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 16:25:20 PDT 2020


Author: Vedant Kumar
Date: 2020-10-26T16:25:08-07:00
New Revision: a77a739abcfa1c5734d374e1afb51cebdb6f36bd

URL: https://github.com/llvm/llvm-project/commit/a77a739abcfa1c5734d374e1afb51cebdb6f36bd
DIFF: https://github.com/llvm/llvm-project/commit/a77a739abcfa1c5734d374e1afb51cebdb6f36bd.diff

LOG: [profile] Suppress spurious 'expected profile to require unlock' warning

In %c (continuous sync) mode, avoid attempting to unlock an
already-unlocked profile.

The profile is only locked when profile merging is enabled.

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingFile.c
    compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index b43f91794e28..bd1ec44fc77e 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -668,7 +668,8 @@ static void initializeProfileForContinuousMode(void) {
         FileOffsetToCounters);
   }
 
-  unlockProfile(&ProfileRequiresUnlock, File);
+  if (ProfileRequiresUnlock)
+    unlockProfile(&ProfileRequiresUnlock, File);
 #endif // defined(__Fuchsia__) || defined(_WIN32)
 }
 

diff  --git a/compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c b/compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
index b56b923a3200..da42500df616 100644
--- a/compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
+++ b/compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
@@ -5,7 +5,7 @@
 // RUN: %clang_pgogen -dynamiclib -o %t.dso1.dylib %t.dso1.c
 // RUN: %clang_pgogen -dynamiclib -o %t.dso2.dylib %t.dso2.c
 // RUN: %clang_pgogen -o %t.exe %s %t.dso1.dylib %t.dso2.dylib
-// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
+// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe 2>&1 | count 0
 // RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s
 
 // CHECK-LABEL: Counters:


        


More information about the llvm-commits mailing list