[PATCH] D19269: [gold-plugin] Disable name for values other than GlobalValue

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 06:07:23 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266871: [gold-plugin] Disable name for values other than GlobalValue (authored by tejohnson).

Changed prior to commit:
  http://reviews.llvm.org/D19269?vs=54354&id=54356#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19269

Files:
  llvm/trunk/test/tools/gold/X86/strip_names.ll
  llvm/trunk/tools/gold/gold-plugin.cpp

Index: llvm/trunk/test/tools/gold/X86/strip_names.ll
===================================================================
--- llvm/trunk/test/tools/gold/X86/strip_names.ll
+++ llvm/trunk/test/tools/gold/X86/strip_names.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    --plugin-opt=discard-value-names \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | 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
+
+ at GlobalValueName = global i32 0
+
+define i32 @foo(i32 %in) {
+somelabel:
+  %GV = load i32, i32* @GlobalValueName
+  %add = add i32 %in, %GV
+  ret i32 %add
+}
Index: llvm/trunk/tools/gold/gold-plugin.cpp
===================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp
+++ llvm/trunk/tools/gold/gold-plugin.cpp
@@ -167,8 +167,10 @@
   static unsigned Parallelism = 0;
 #ifdef NDEBUG
   static bool DisableVerify = true;
+  static bool DiscardValueNames = true;
 #else
   static bool DisableVerify = false;
+  static bool DiscardValueNames = false;
 #endif
   static std::string obj_path;
   static std::string extra_library_path;
@@ -225,6 +227,8 @@
         message(LDPL_FATAL, "Invalid parallelism level: %s", opt_ + 5);
     } else if (opt == "disable-verify") {
       DisableVerify = true;
+    } else if (opt == "discard-value-names") {
+      DiscardValueNames = true;
     } else {
       // Save this option to pass to the code generator.
       // ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -1114,6 +1118,7 @@
                                raw_fd_ostream *OS, unsigned TaskID) {
   // Need to use a separate context for each task
   LLVMContext Context;
+  Context.setDiscardValueNames(options::DiscardValueNames);
   Context.enableDebugTypeODRUniquing(); // Merge debug info types.
   Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
 
@@ -1236,6 +1241,7 @@
   }
 
   LLVMContext Context;
+  Context.setDiscardValueNames(options::DiscardValueNames);
   Context.enableDebugTypeODRUniquing(); // Merge debug info types.
   Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19269.54356.patch
Type: text/x-patch
Size: 2739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160420/6b3419d6/attachment.bin>


More information about the llvm-commits mailing list