[llvm] r266881 - Re-enable "[gold-plugin] Disable name for values other than GlobalValue"
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 08:16:58 PDT 2016
Author: tejohnson
Date: Wed Apr 20 10:16:57 2016
New Revision: 266881
URL: http://llvm.org/viewvc/llvm-project?rev=266881&view=rev
Log:
Re-enable "[gold-plugin] Disable name for values other than GlobalValue"
This restores r266871 with a fix for gold tests relying on the value
names, when using a release compiler, by adding a way to disable the
default discarding. Update affected tests to use the new mechanism so
that value names are preserved as expected, regardless of how the
compiler was built.
Added:
llvm/trunk/test/tools/gold/X86/strip_names.ll
Modified:
llvm/trunk/test/tools/gold/X86/comdat.ll
llvm/trunk/test/tools/gold/X86/type-merge2.ll
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/test/tools/gold/X86/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/comdat.ll?rev=266881&r1=266880&r2=266881&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/X86/comdat.ll (original)
+++ llvm/trunk/test/tools/gold/X86/comdat.ll Wed Apr 20 10:16:57 2016
@@ -1,6 +1,7 @@
; RUN: llvm-as %s -o %t.o
; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
+; RUN: -plugin-opt=no-discard-value-names \
; RUN: -plugin-opt=emit-llvm
; RUN: llvm-dis %t3.o -o - | FileCheck %s
Added: llvm/trunk/test/tools/gold/X86/strip_names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/strip_names.ll?rev=266881&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/strip_names.ll (added)
+++ llvm/trunk/test/tools/gold/X86/strip_names.ll Wed Apr 20 10:16:57 2016
@@ -0,0 +1,36 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: --plugin-opt=no-discard-value-names \
+; 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
+}
Modified: llvm/trunk/test/tools/gold/X86/type-merge2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/type-merge2.ll?rev=266881&r1=266880&r2=266881&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/X86/type-merge2.ll (original)
+++ llvm/trunk/test/tools/gold/X86/type-merge2.ll Wed Apr 20 10:16:57 2016
@@ -2,6 +2,7 @@
; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
+; RUN: --plugin-opt=no-discard-value-names \
; RUN: -shared %t.o %t2.o -o %t3.o
; RUN: llvm-dis %t3.o -o - | FileCheck %s
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=266881&r1=266880&r2=266881&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Apr 20 10:16:57 2016
@@ -166,8 +166,10 @@ namespace options {
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;
@@ -224,6 +226,10 @@ namespace options {
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 if (opt == "no-discard-value-names") {
+ DiscardValueNames = false;
} else {
// Save this option to pass to the code generator.
// ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -1113,6 +1119,7 @@ static void thinLTOBackendTask(claimed_f
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);
@@ -1235,6 +1242,7 @@ static ld_plugin_status allSymbolsReadHo
}
LLVMContext Context;
+ Context.setDiscardValueNames(options::DiscardValueNames);
Context.enableDebugTypeODRUniquing(); // Merge debug info types.
Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
More information about the llvm-commits
mailing list