[BOLT] Fix perf2bolt race in BAT mode

Summary:
We start a thread to preprocess the profile while the main
thread continues to disassemble the input binary. We should not
disassemble it in BAT mode, however, the test to check whether we have
BAT in the input binary depends on the preprocessing thread, so there
is a race where we may start disassembling functions just because the
preprocessing thread didn't conclude we are in BAT mode. Fix this and
make the main thread check for BAT without depending on the
preprocessing thread.

(cherry picked from FBD17124370)
This commit is contained in:
Rafael Auler 2019-08-29 16:18:43 -07:00 committed by Maksim Panchenko
parent 1f6564f117
commit 52786928ff
1 changed files with 1 additions and 1 deletions

View File

@ -1101,7 +1101,7 @@ void RewriteInstance::run() {
// Skip disassembling if we have a translation table and we are running an
// aggregation job.
if (!opts::AggregateOnly || !DA.usesBAT()) {
if (!opts::AggregateOnly || !BAT->enabledFor(InputFile)) {
disassembleFunctions();
}