[lld] r267020 - [LTO] Discard names for values that are not global by default.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 10:46:39 PDT 2016
Author: davide
Date: Thu Apr 21 12:46:38 2016
New Revision: 267020
URL: http://llvm.org/viewvc/llvm-project?rev=267020&view=rev
Log:
[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.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Options.td
lld/trunk/test/ELF/lto/discard-value-names.ll
lld/trunk/test/ELF/lto/type-merge2.ll
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=267020&r1=267019&r2=267020&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Apr 21 12:46:38 2016
@@ -289,7 +289,7 @@ void LinkerDriver::readConfigs(opt::Inpu
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);
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=267020&r1=267019&r2=267020&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Thu Apr 21 12:46:38 2016
@@ -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">;
Modified: lld/trunk/test/ELF/lto/discard-value-names.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/discard-value-names.ll?rev=267020&r1=267019&r2=267020&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/discard-value-names.ll (original)
+++ lld/trunk/test/ELF/lto/discard-value-names.ll Thu Apr 21 12:46:38 2016
@@ -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
Modified: lld/trunk/test/ELF/lto/type-merge2.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/type-merge2.ll?rev=267020&r1=267019&r2=267020&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/type-merge2.ll (original)
+++ lld/trunk/test/ELF/lto/type-merge2.ll Thu Apr 21 12:46:38 2016
@@ -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"
More information about the llvm-commits
mailing list