Dispose the codegen even when just writing the bitcode file.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 3 Oct 2013 00:07:30 +0000 (00:07 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 3 Oct 2013 00:07:30 +0000 (00:07 +0000)
This makes it possible to add timers to the code generator and still use them
with -plugin-opt=emit-llvm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191866 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index 77717098d61462701753209c71071e12cc889506..bd11d1b55566d3c0c34b6552cfe2fa34e37a8913 100644 (file)
@@ -417,8 +417,10 @@ static ld_plugin_status all_symbols_read_hook(void) {
     bool err = lto_codegen_write_merged_modules(code_gen, path.c_str());
     if (err)
       (*message)(LDPL_FATAL, "Failed to write the output file.");
-    if (options::generate_bc_file == options::BC_ONLY)
+    if (options::generate_bc_file == options::BC_ONLY) {
+      lto_codegen_dispose(code_gen);
       exit(0);
+    }
   }
   const char *objPath;
   if (lto_codegen_compile_to_file(code_gen, &objPath)) {