From aaf49b095f58ff95cfeec5add70556fb21bff3c8 Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Wed, 12 Aug 2020 18:10:41 -0700 Subject: [PATCH] [perf2bolt] Issue error when writing YAML for BOLTed input Summary: When the input file is processed by BOLT, we cannot save profile in YAML format as it requires CFG representation of functions. (cherry picked from FBD22941794) --- bolt/src/RewriteInstance.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bolt/src/RewriteInstance.cpp b/bolt/src/RewriteInstance.cpp index 9a689b623f5a..d779a3a39380 100644 --- a/bolt/src/RewriteInstance.cpp +++ b/bolt/src/RewriteInstance.cpp @@ -1714,6 +1714,13 @@ void RewriteInstance::adjustCommandLineOptions() { if (opts::Lite) { outs() << "BOLT-INFO: enabling lite mode\n"; } + + if (!opts::SaveProfile.empty() && BAT->enabledFor(InputFile)) { + errs() << "BOLT-ERROR: unable to save profile in YAML format for input " + "file processed by BOLT. Please remove -w option and use branch " + "profile.\n"; + exit(1); + } } namespace {