[lld] r266953 - [LTO] Discard names for Values that are not global.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 12:18:15 PDT 2016
Do you still need a knob to keep local names, not as a debug flag but as
user-visible command line flag?
On Thu, Apr 21, 2016 at 10:53 AM, Davide Italiano via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> r267020, thanks for benchmarking!
>
> On Thu, Apr 21, 2016 at 6:59 AM, Rafael EspĂndola
> <rafael.espindola at gmail.com> wrote:
> > According to heaptrack this takes the peak memory consumption when
> > linking llvm-as from 185.14 MB to 159.89MB, so I would highly
> > recommend changing the default now :-)
> >
> > Cheers,
> > Rafael
> >
> >
> > On 21 April 2016 at 00:46, Davide Italiano via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> >> Author: davide
> >> Date: Wed Apr 20 23:46:22 2016
> >> New Revision: 266953
> >>r267020
> >> URL: http://llvm.org/viewvc/llvm-project?rev=266953&view=rev
> >> Log:
> >> [LTO] Discard names for Values that are not global.
> >>
> >> This is not on by default (but it might be in the future).
> >> The knob to enable the optimization is -lto-discard-value-names.
> >>
> >> Added:
> >> lld/trunk/test/ELF/lto/discard-value-names.ll
> >> Modified:
> >> lld/trunk/ELF/Config.h
> >> lld/trunk/ELF/Driver.cpp
> >> lld/trunk/ELF/LTO.h
> >> lld/trunk/ELF/Options.td
> >>
> >> Modified: lld/trunk/ELF/Config.h
> >> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=266953&r1=266952&r2=266953&view=diff
> >>
> ==============================================================================
> >> --- lld/trunk/ELF/Config.h (original)
> >> +++ lld/trunk/ELF/Config.h Wed Apr 20 23:46:22 2016
> >> @@ -58,6 +58,7 @@ struct Configuration {
> >> bool Demangle = true;
> >> bool DisableVerify;
> >> bool DiscardAll;
> >> + bool DiscardValueNames;
> >> bool DiscardLocals;
> >> bool DiscardNone;
> >> bool EhFrameHdr;
> >>
> >> Modified: lld/trunk/ELF/Driver.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=266953&r1=266952&r2=266953&view=diff
> >>
> ==============================================================================
> >> --- lld/trunk/ELF/Driver.cpp (original)
> >> +++ lld/trunk/ELF/Driver.cpp Wed Apr 20 23:46:22 2016
> >> @@ -289,6 +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->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/LTO.h
> >> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.h?rev=266953&r1=266952&r2=266953&view=diff
> >>
> ==============================================================================
> >> --- lld/trunk/ELF/LTO.h (original)
> >> +++ lld/trunk/ELF/LTO.h Wed Apr 20 23:46:22 2016
> >> @@ -21,6 +21,7 @@
> >> #ifndef LLD_ELF_LTO_H
> >> #define LLD_ELF_LTO_H
> >>
> >> +#include "Config.h"
> >> #include "lld/Core/LLVM.h"
> >> #include "llvm/ADT/SmallString.h"
> >> #include "llvm/ADT/StringSet.h"
> >> @@ -41,6 +42,7 @@ public:
> >>
> >> BitcodeCompiler()
> >> : Combined(new llvm::Module("ld-temp.o", Context)),
> Mover(*Combined) {
> >> + Context.setDiscardValueNames(Config->DiscardValueNames);
> >> Context.enableDebugTypeODRUniquing();
> >> }
> >>
> >>
> >> Modified: lld/trunk/ELF/Options.td
> >> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=266953&r1=266952&r2=266953&view=diff
> >>
> ==============================================================================
> >> --- lld/trunk/ELF/Options.td (original)
> >> +++ lld/trunk/ELF/Options.td Wed Apr 20 23:46:22 2016
> >> @@ -238,6 +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_jobs : Joined<["--"], "lto-jobs=">,
> >> HelpText<"Number of threads to run codegen">;
> >> def disable_verify : Flag<["-"], "disable-verify">;
> >>
> >> Added: 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=266953&view=auto
> >>
> ==============================================================================
> >> --- lld/trunk/test/ELF/lto/discard-value-names.ll (added)
> >> +++ lld/trunk/test/ELF/lto/discard-value-names.ll Wed Apr 20 23:46:22
> 2016
> >> @@ -0,0 +1,33 @@
> >> +; RUN: llvm-as %s -o %t.o
> >> +
> >> +; RUN: ld.lld -m elf_x86_64 -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: llvm-dis < %t2.o.lto.bc | FileCheck --check-prefix=NONAME %s
> >> +
> >> +; CHECK: @GlobalValueName
> >> +; CHECK: @foo(i32 %in)
> >> +; CHECK: somelabel:
> >> +; CHECK: %GV = load i32, i32* @GlobalValueName
> >> +; 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"
> >> +
> >> + at GlobalValueName = global i32 0
> >> +
> >> +define i32 @foo(i32 %in) {
> >> +somelabel:
> >> + %GV = load i32, i32* @GlobalValueName
> >> + %add = add i32 %in, %GV
> >> + ret i32 %add
> >> +}
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/3776b45e/attachment.html>
More information about the llvm-commits
mailing list