Index: lld/trunk/ELF/Config.h =================================================================== --- lld/trunk/ELF/Config.h +++ lld/trunk/ELF/Config.h @@ -59,7 +59,6 @@ bool Demangle = true; bool DisableVerify; bool DiscardAll; - bool DiscardValueNames; bool DiscardLocals; bool DiscardNone; bool EhFrameHdr; Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -284,7 +284,6 @@ Config->Demangle = !Args.hasArg(OPT_no_demangle); Config->DisableVerify = Args.hasArg(OPT_disable_verify); Config->DiscardAll = Args.hasArg(OPT_discard_all); - Config->DiscardValueNames = !Args.hasArg(OPT_lto_no_discard_value_names); Config->DiscardLocals = Args.hasArg(OPT_discard_locals); Config->DiscardNone = Args.hasArg(OPT_discard_none); Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr); Index: lld/trunk/ELF/LTO.cpp =================================================================== --- lld/trunk/ELF/LTO.cpp +++ lld/trunk/ELF/LTO.cpp @@ -87,7 +87,11 @@ BitcodeCompiler::BitcodeCompiler() : Combined(new llvm::Module("ld-temp.o", Context)), Mover(*Combined) { - Context.setDiscardValueNames(Config->DiscardValueNames); + // This is a flag to discard all but GlobalValue names. + // We want to enable it by default because it saves memory. + // Disable it only when a developer option (-save-temps) is given. + Context.setDiscardValueNames(!Config->SaveTemps); + Context.enableDebugTypeODRUniquing(); } Index: lld/trunk/ELF/Options.td =================================================================== --- lld/trunk/ELF/Options.td +++ lld/trunk/ELF/Options.td @@ -245,7 +245,6 @@ def alias_version_script_version_script : Joined<["--"], "version-script=">, Alias; // LTO-related options. -def lto_no_discard_value_names : Flag<["-"], "lto-no-discard-value-names">; def lto_jobs : Joined<["--"], "lto-jobs=">, HelpText<"Number of threads to run codegen">; def disable_verify : Flag<["-"], "disable-verify">; Index: lld/trunk/test/ELF/lto/discard-value-names.ll =================================================================== --- lld/trunk/test/ELF/lto/discard-value-names.ll +++ lld/trunk/test/ELF/lto/discard-value-names.ll @@ -1,10 +1,7 @@ ; RUN: llvm-as %s -o %t.o -; RUN: ld.lld -m elf_x86_64 -lto-no-discard-value-names -shared -save-temps %t.o -o %t2.o -; RUN: llvm-dis < %t2.o.lto.bc | FileCheck %s - ; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o -; RUN: llvm-dis < %t2.o.lto.bc | FileCheck --check-prefix=NONAME %s +; RUN: llvm-dis < %t2.o.lto.bc | FileCheck %s ; CHECK: @GlobalValueName ; CHECK: @foo(i32 %in) @@ -13,13 +10,6 @@ ; CHECK: %add = add i32 %in, %GV ; CHECK: ret i32 %add -; NONAME: @GlobalValueName -; NONAME: @foo(i32) -; NONAME-NOT: somelabel: -; NONAME: %2 = load i32, i32* @GlobalValueName -; NONAME: %3 = add i32 %0, %2 -; NONAME: ret i32 %3 - target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" Index: lld/trunk/test/ELF/lto/type-merge2.ll =================================================================== --- lld/trunk/test/ELF/lto/type-merge2.ll +++ lld/trunk/test/ELF/lto/type-merge2.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o -; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps -lto-no-discard-value-names +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps ; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s target triple = "x86_64-unknown-linux-gnu"