[PATCH] D19437: LTO: Merge -lto-no-discard-value-names with -save-temps.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 14:38:19 PDT 2016


ruiu created this revision.
ruiu added reviewers: davide, pcc.
ruiu added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

This patch is to remove -lto-no-discard-value-names flag and
instead to use -save-temps as we discussed in the post-commit
review thread for r267020.

http://reviews.llvm.org/D19437

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/LTO.cpp
  ELF/Options.td
  test/ELF/lto/discard-value-names.ll
  test/ELF/lto/type-merge2.ll

Index: test/ELF/lto/type-merge2.ll
===================================================================
--- test/ELF/lto/type-merge2.ll
+++ 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"
Index: test/ELF/lto/discard-value-names.ll
===================================================================
--- test/ELF/lto/discard-value-names.ll
+++ test/ELF/lto/discard-value-names.ll
@@ -1,25 +1,15 @@
 ; 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)
 ; 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"
 
Index: ELF/Options.td
===================================================================
--- ELF/Options.td
+++ ELF/Options.td
@@ -245,7 +245,6 @@
 def alias_version_script_version_script : Joined<["--"], "version-script=">, Alias<version_script>;
 
 // 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: ELF/LTO.cpp
===================================================================
--- ELF/LTO.cpp
+++ 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: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ 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: ELF/Config.h
===================================================================
--- ELF/Config.h
+++ ELF/Config.h
@@ -59,7 +59,6 @@
   bool Demangle = true;
   bool DisableVerify;
   bool DiscardAll;
-  bool DiscardValueNames;
   bool DiscardLocals;
   bool DiscardNone;
   bool EhFrameHdr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19437.54728.patch
Type: text/x-patch
Size: 3518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160422/fd4c0e5f/attachment.bin>


More information about the llvm-commits mailing list