Make internal/private GVs implicitly dso_local.
While updating clang tests for having clang set dso_local I noticed
that:
- There are *a lot* of tests to update.
- Many of the updates are redundant.
They are redundant because a GV is "obviously dso_local". This patch
starts formalizing that a bit by requiring that internal and private
GVs be dso_local too. Since they all are, we don't have to print
dso_local to the textual representation, making it a bit more compact
and easier to read.
llvm-svn: 322317
diff --git a/llvm/test/ThinLTO/X86/alias_import.ll b/llvm/test/ThinLTO/X86/alias_import.ll
index ee4d533..da4d52a 100644
--- a/llvm/test/ThinLTO/X86/alias_import.ll
+++ b/llvm/test/ThinLTO/X86/alias_import.ll
@@ -57,11 +57,11 @@
; IMPORT-DAG: declare void @globalfuncLinkonceAlias()
; IMPORT-DAG: define available_externally void @globalfuncWeakODRAlias()
; IMPORT-DAG: define available_externally void @globalfuncLinkonceODRAlias()
-; IMPORT-DAG: define available_externally void @internalfuncAlias()
+; IMPORT-DAG: define available_externally dso_local void @internalfuncAlias()
; IMPORT-DAG: declare void @internalfuncWeakAlias()
; IMPORT-DAG: declare void @internalfuncLinkonceAlias()
-; IMPORT-DAG: define available_externally void @internalfuncWeakODRAlias()
-; IMPORT-DAG: define available_externally void @internalfuncLinkonceODRAlias()
+; IMPORT-DAG: define available_externally dso_local void @internalfuncWeakODRAlias()
+; IMPORT-DAG: define available_externally dso_local void @internalfuncLinkonceODRAlias()
; IMPORT-DAG: define available_externally void @weakODRfuncAlias()
; IMPORT-DAG: declare void @weakODRfuncWeakAlias()
; IMPORT-DAG: declare void @weakODRfuncLinkonceAlias()
diff --git a/llvm/test/ThinLTO/X86/deadstrip.ll b/llvm/test/ThinLTO/X86/deadstrip.ll
index bd9e349..0764f5c 100644
--- a/llvm/test/ThinLTO/X86/deadstrip.ll
+++ b/llvm/test/ThinLTO/X86/deadstrip.ll
@@ -23,10 +23,10 @@
; RUN: llvm-nm %t.out.1 | FileCheck %s --check-prefix=CHECK2-NM
; RUN: llvm-bcanalyzer -dump %t.out.index.bc | FileCheck %s --check-prefix=COMBINED
-; Live, NotEligibleForImport, Internal
-; COMBINED-DAG: <COMBINED {{.*}} op2=55
-; Live, Internal
-; COMBINED-DAG: <COMBINED {{.*}} op2=39
+; Live, NotEligibleForImport, dso_local, Internal
+; COMBINED-DAG: <COMBINED {{.*}} op2=119
+; Live, dso_local, Internal
+; COMBINED-DAG: <COMBINED {{.*}} op2=103
; Live, Local, External
; COMBINED-DAG: <COMBINED {{.*}} op2=96
; COMBINED-DAG: <COMBINED {{.*}} op2=96
@@ -48,9 +48,9 @@
; LTO2-NOT: available_externally {{.*}} @baz()
; LTO2: @llvm.global_ctors =
; LTO2: define internal void @_GLOBAL__I_a()
-; LTO2: define internal dso_local void @bar() {
+; LTO2: define internal void @bar() {
; LTO2: define internal void @bar_internal()
-; LTO2: define internal dso_local void @dead_func() {
+; LTO2: define internal void @dead_func() {
; LTO2-NOT: available_externally {{.*}} @baz()
; Make sure we didn't internalize @boo, which is reachable via
diff --git a/llvm/test/ThinLTO/X86/export.ll b/llvm/test/ThinLTO/X86/export.ll
index cb87ddd..19aac1c 100644
--- a/llvm/test/ThinLTO/X86/export.ll
+++ b/llvm/test/ThinLTO/X86/export.ll
@@ -5,8 +5,8 @@
; Ensure statics are promoted/renamed correctly from this file.
; RUN: llvm-lto -thinlto-action=promote %t1.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s
-; CHECK-DAG: @staticvar.llvm.0 = hidden global
-; CHECK-DAG: define hidden void @staticfunc.llvm.0
+; CHECK-DAG: @staticvar.llvm.0 = dso_local hidden global
+; CHECK-DAG: define dso_local hidden void @staticfunc.llvm.0
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
diff --git a/llvm/test/ThinLTO/X86/funcimport.ll b/llvm/test/ThinLTO/X86/funcimport.ll
index 1e8784d..1d853ee 100644
--- a/llvm/test/ThinLTO/X86/funcimport.ll
+++ b/llvm/test/ThinLTO/X86/funcimport.ll
@@ -9,12 +9,12 @@
; Ensure statics are promoted/renamed correctly from this file (all but
; constant variable need promotion).
; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTSTATIC
-; EXPORTSTATIC-DAG: @staticvar.llvm.0 = hidden global
+; EXPORTSTATIC-DAG: @staticvar.llvm.0 = dso_local hidden global
; Eventually @staticconstvar can be exported as a copy and not promoted
-; EXPORTSTATIC-DAG: @staticconstvar.llvm.0 = hidden unnamed_addr constant
-; EXPORTSTATIC-DAG: @P.llvm.0 = hidden global void ()* null
-; EXPORTSTATIC-DAG: define hidden i32 @staticfunc.llvm.0
-; EXPORTSTATIC-DAG: define hidden void @staticfunc2.llvm.0
+; EXPORTSTATIC-DAG: @staticconstvar.llvm.0 = dso_local hidden unnamed_addr constant
+; EXPORTSTATIC-DAG: @P.llvm.0 = dso_local hidden global void ()* null
+; EXPORTSTATIC-DAG: define dso_local hidden i32 @staticfunc.llvm.0
+; EXPORTSTATIC-DAG: define dso_local hidden void @staticfunc2.llvm.0
; Ensure that weak alias to an imported function is correctly turned into
; a declaration.
diff --git a/llvm/test/ThinLTO/X86/internalize.ll b/llvm/test/ThinLTO/X86/internalize.ll
index 2392a4e..9ff173e 100644
--- a/llvm/test/ThinLTO/X86/internalize.ll
+++ b/llvm/test/ThinLTO/X86/internalize.ll
@@ -17,8 +17,8 @@
; INTERNALIZE: define internal void @bar
; INTERNALIZE: define internal void @linkonce_func()
; INTERNALIZE2: define dso_local void @foo
-; INTERNALIZE2: define internal dso_local void @bar
-; INTERNALIZE2: define internal dso_local void @linkonce_func()
+; INTERNALIZE2: define internal void @bar
+; INTERNALIZE2: define internal void @linkonce_func()
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
diff --git a/llvm/test/ThinLTO/X86/local_name_conflict.ll b/llvm/test/ThinLTO/X86/local_name_conflict.ll
index e4eb33e..cefc3ee 100644
--- a/llvm/test/ThinLTO/X86/local_name_conflict.ll
+++ b/llvm/test/ThinLTO/X86/local_name_conflict.ll
@@ -13,7 +13,7 @@
; promoted name matches the imported copy.
; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
; IMPORT: call i32 @foo.llvm.[[HASH:[0-9]+]]
-; IMPORT: define available_externally hidden i32 @foo.llvm.[[HASH]]()
+; IMPORT: define available_externally dso_local hidden i32 @foo.llvm.[[HASH]]()
; The copy in %t2.bc should not be exported/promoted/renamed
; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=NOEXPORTSTATIC
@@ -21,7 +21,7 @@
; Make sure foo is promoted and renamed without complaint in %t3.bc.
; RUN: llvm-lto -thinlto-action=promote %t3.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTSTATIC
-; EXPORTSTATIC: define hidden i32 @foo.llvm.
+; EXPORTSTATIC: define dso_local hidden i32 @foo.llvm.
; ModuleID = 'local_name_conflict_main.o'
source_filename = "local_name_conflict_main.c"
diff --git a/llvm/test/ThinLTO/X86/referenced_by_constant.ll b/llvm/test/ThinLTO/X86/referenced_by_constant.ll
index ac72edd..00cc7b9 100644
--- a/llvm/test/ThinLTO/X86/referenced_by_constant.ll
+++ b/llvm/test/ThinLTO/X86/referenced_by_constant.ll
@@ -9,15 +9,15 @@
; cause @referencedbyglobal and @localreferencedbyglobal to be exported
; and promoted).
; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
-; IMPORT: @someglobal.llvm.0 = external hidden unnamed_addr constant
-; IMPORT: @someglobal2.llvm.0 = external hidden unnamed_addr constant
+; IMPORT: @someglobal.llvm.0 = external dso_local hidden unnamed_addr constant
+; IMPORT: @someglobal2.llvm.0 = external dso_local hidden unnamed_addr constant
; IMPORT: define available_externally void @bar()
; Check the export side: we currently only export bar(), which causes
; @someglobal and @someglobal2 to be promoted (see above).
; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=EXPORT
-; EXPORT: @someglobal.llvm.0 = hidden unnamed_addr constant
-; EXPORT: @someglobal2.llvm.0 = hidden unnamed_addr constant
+; EXPORT: @someglobal.llvm.0 = dso_local hidden unnamed_addr constant
+; EXPORT: @someglobal2.llvm.0 = dso_local hidden unnamed_addr constant
; EXPORT: define void @referencedbyglobal()
; EXPORT: define internal void @localreferencedbyglobal()