[LTO] Discard names for values that are not global by default.

Rafael reported on the mailing list that this reduces peak memory
usage while linking llvm-as by 15%. It makes sense to make it
the default, and introduce an inverse knob -lto-no-discard-value-names
for those who want to restore the old behavior.

llvm-svn: 267020
This commit is contained in:
Davide Italiano 2016-04-21 17:46:38 +00:00
parent 3ac0718423
commit 5abcb3cc5b
4 changed files with 5 additions and 5 deletions

View File

@ -289,7 +289,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
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_discard_value_names);
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);

View File

@ -238,7 +238,7 @@ def G : Separate<["-"], "G">;
def alias_version_script_version_script : Joined<["--"], "version-script=">, Alias<version_script>;
// LTO-related options.
def lto_discard_value_names : Flag<["-"], "lto-discard-value-names">;
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">;

View File

@ -1,9 +1,9 @@
; RUN: llvm-as %s -o %t.o
; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.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 -lto-discard-value-names -shared -save-temps %t.o -o %t2.o
; 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
; CHECK: @GlobalValueName

View File

@ -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
; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps -lto-no-discard-value-names
; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"