From: Amir Ayupov Date: Thu, 10 Mar 2022 04:27:15 +0000 (-0800) Subject: [BOLT][NFC] Fix print-cfg data race X-Git-Tag: upstream/15.0.7~14065 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1638cb0b5b24fc4895902721d622216d08fc186;p=platform%2Fupstream%2Fllvm.git [BOLT][NFC] Fix print-cfg data race Addresses ThreadSanitizer warning Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D121337 --- diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index ea2cee1..b814862 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -2950,8 +2950,10 @@ void RewriteInstance::buildFunctionsCFG() { if (!BF.buildCFG(AllocId)) return; - if (opts::PrintAll) + if (opts::PrintAll) { + auto L = BC->scopeLock(); BF.print(outs(), "while building cfg", true); + } }; ParallelUtilities::PredicateTy SkipPredicate = [&](const BinaryFunction &BF) {