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

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 10:57:47 PDT 2016


On Thu, Apr 21, 2016 at 10:46 AM, Davide Italiano via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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">;
>

We probably don't want to name flags "-l(something)", as that would
conflict with the -l flag. Can you please rename this "--lto-..."?

(That is, if we want a flag for this at all. Have you considered gating
this behavior behind -save-temps instead?)

Thanks,
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/9f8681a1/attachment.html>


More information about the llvm-commits mailing list