[PATCH] D45531: [LTO] Add stats-file option to LTO/Config.h.

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 08:08:05 PDT 2018


tejohnson added inline comments.


================
Comment at: tools/gold/gold-plugin.cpp:206
   static std::string dwo_dir;
+  static std::string stats_file;
 
----------------
document


================
Comment at: tools/gold/gold-plugin.cpp:1057
     if (llvm::AreStatisticsEnabled())
       llvm::PrintStatistics();
     cleanup_hook();
----------------
I think there is going to be a strange interaction with this code. I added this so that we still get the stats printed to stderr under the -stats llvm internal option when we exit early because we are only doing the ThinLTO indexing step (for distrubuted ThinLTO builds), since we don't execute ~StatisticInfo() in that case. The problem is that AreStatisticsEnabled() returns "Enabled || Stats", and Enabled will be true with this patch if the new stats-file plugin option is specified. So I think what would happen for distributed builds, when we exit early here, if the new plugin option is passed we will incorrectly dump stats to stderr as well.

Hmm, looks like we should probably just call llvm_shutdown() here before we exit, which would take care of destructing StatisticInfo. Let me try that and get back...


https://reviews.llvm.org/D45531





More information about the llvm-commits mailing list