From fb7a0b8943eb9ea3e356f7c9b302ad00a23dfb2a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 3 Oct 2013 00:07:30 +0000 Subject: [PATCH] Dispose the codegen even when just writing the bitcode file. This makes it possible to add timers to the code generator and still use them with -plugin-opt=emit-llvm. llvm-svn: 191866 --- llvm/tools/gold/gold-plugin.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 77717098d614..bd11d1b55566 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -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)) {