[gold/ThinLTO] Invoke llvm_shutdown when exiting after ThinLTO indexing
authorTeresa Johnson <tejohnson@google.com>
Thu, 19 Apr 2018 16:55:13 +0000 (16:55 +0000)
committerTeresa Johnson <tejohnson@google.com>
Thu, 19 Apr 2018 16:55:13 +0000 (16:55 +0000)
Summary:
Instead of manually invoking PrintStatistics, simply invoke
llvm_shutdown which will take care of destroying managed statics, and as
a side effect will destroy the StatisticInfo ManagedStatic, invoking
PrintStatistics when needed.

Reviewers: fhahn

Subscribers: inglorion, llvm-commits

Differential Revision: https://reviews.llvm.org/D45820

llvm-svn: 330341

llvm/tools/gold/gold-plugin.cpp

index 607f3f5..e39abe6 100644 (file)
@@ -1061,8 +1061,7 @@ static ld_plugin_status allSymbolsReadHook() {
     return LDPS_OK;
 
   if (options::thinlto_index_only) {
-    if (llvm::AreStatisticsEnabled())
-      llvm::PrintStatistics();
+    llvm_shutdown();
     cleanup_hook();
     exit(0);
   }