1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

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
This commit is contained in:
Rafael Espindola 2018-01-11 22:15:05 +00:00
parent c53ec0941d
commit 3457994310
39 changed files with 122 additions and 102 deletions

View File

@ -77,11 +77,12 @@ protected:
GlobalValue(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)
: Constant(PointerType::get(Ty, AddressSpace), VTy, Ops, NumOps),
ValueType(Ty), Linkage(Linkage), Visibility(DefaultVisibility),
ValueType(Ty), Visibility(DefaultVisibility),
UnnamedAddrVal(unsigned(UnnamedAddr::None)),
DllStorageClass(DefaultStorageClass), ThreadLocal(NotThreadLocal),
HasLLVMReservedName(false), IsDSOLocal(false),
IntID((Intrinsic::ID)0U), Parent(nullptr) {
HasLLVMReservedName(false), IsDSOLocal(false), IntID((Intrinsic::ID)0U),
Parent(nullptr) {
setLinkage(Linkage);
setName(Name);
}
@ -434,8 +435,11 @@ public:
}
void setLinkage(LinkageTypes LT) {
if (isLocalLinkage(LT))
if (isLocalLinkage(LT)) {
Visibility = DefaultVisibility;
if (getValueID() != Value::GlobalIFuncVal)
setDSOLocal(true);
}
Linkage = LT;
}
LinkageTypes getLinkage() const { return LinkageTypes(Linkage); }

View File

@ -715,6 +715,13 @@ static bool isValidVisibilityForLinkage(unsigned V, unsigned L) {
(GlobalValue::VisibilityTypes)V == GlobalValue::DefaultVisibility;
}
// If there was an explicit dso_local, update GV. In the absence of an explicit
// dso_local we keep the default value.
static void maybeSetDSOLocal(bool DSOLocal, GlobalValue &GV) {
if (DSOLocal)
GV.setDSOLocal(true);
}
/// parseIndirectSymbol:
/// ::= GlobalVar '=' OptionalLinkage OptionalPreemptionSpecifier
/// OptionalVisibility OptionalDLLStorageClass
@ -826,7 +833,7 @@ bool LLParser::parseIndirectSymbol(const std::string &Name, LocTy NameLoc,
GA->setVisibility((GlobalValue::VisibilityTypes)Visibility);
GA->setDLLStorageClass((GlobalValue::DLLStorageClassTypes)DLLStorageClass);
GA->setUnnamedAddr(UnnamedAddr);
GA->setDSOLocal(DSOLocal);
maybeSetDSOLocal(DSOLocal, *GA);
if (Name.empty())
NumberedVals.push_back(GA.get());
@ -947,7 +954,7 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
GV->setInitializer(Init);
GV->setConstant(IsConstant);
GV->setLinkage((GlobalValue::LinkageTypes)Linkage);
GV->setDSOLocal(DSOLocal);
maybeSetDSOLocal(DSOLocal, *GV);
GV->setVisibility((GlobalValue::VisibilityTypes)Visibility);
GV->setDLLStorageClass((GlobalValue::DLLStorageClassTypes)DLLStorageClass);
GV->setExternallyInitialized(IsExternallyInitialized);
@ -4923,7 +4930,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
NumberedVals.push_back(Fn);
Fn->setLinkage((GlobalValue::LinkageTypes)Linkage);
Fn->setDSOLocal(DSOLocal);
maybeSetDSOLocal(DSOLocal, *Fn);
Fn->setVisibility((GlobalValue::VisibilityTypes)Visibility);
Fn->setDLLStorageClass((GlobalValue::DLLStorageClassTypes)DLLStorageClass);
Fn->setCallingConv(CC);

View File

@ -2497,8 +2497,10 @@ static void PrintVisibility(GlobalValue::VisibilityTypes Vis,
}
}
static void PrintDSOLocation(bool IsDSOLocal, formatted_raw_ostream &Out){
if (IsDSOLocal)
static void PrintDSOLocation(const GlobalValue &GV,
formatted_raw_ostream &Out) {
// GVs with local linkage are implicitly dso_local, so we don't print it.
if (GV.isDSOLocal() && !GV.hasLocalLinkage())
Out << "dso_local ";
}
@ -2572,7 +2574,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
Out << "external ";
Out << getLinkagePrintName(GV->getLinkage());
PrintDSOLocation(GV->isDSOLocal(), Out);
PrintDSOLocation(*GV, Out);
PrintVisibility(GV->getVisibility(), Out);
PrintDLLStorageClass(GV->getDLLStorageClass(), Out);
PrintThreadLocalModel(GV->getThreadLocalMode(), Out);
@ -2619,7 +2621,7 @@ void AssemblyWriter::printIndirectSymbol(const GlobalIndirectSymbol *GIS) {
Out << " = ";
Out << getLinkagePrintName(GIS->getLinkage());
PrintDSOLocation(GIS->isDSOLocal(), Out);
PrintDSOLocation(*GIS, Out);
PrintVisibility(GIS->getVisibility(), Out);
PrintDLLStorageClass(GIS->getDLLStorageClass(), Out);
PrintThreadLocalModel(GIS->getThreadLocalMode(), Out);
@ -2731,7 +2733,7 @@ void AssemblyWriter::printFunction(const Function *F) {
Out << "define ";
Out << getLinkagePrintName(F->getLinkage());
PrintDSOLocation(F->isDSOLocal(), Out);
PrintDSOLocation(*F, Out);
PrintVisibility(F->getVisibility(), Out);
PrintDLLStorageClass(F->getDLLStorageClass(), Out);

View File

@ -570,6 +570,11 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
Assert(!GV.isDSOLocal(),
"GlobalValue with DLLImport Storage is dso_local!", &GV);
if (GV.hasLocalLinkage())
Assert(GV.isDSOLocal(),
"GlobalValue with private or internal linkage must be dso_local!",
&GV);
forEachUser(&GV, GlobalValueVisited, [&](const Value *V) -> bool {
if (const Instruction *I = dyn_cast<Instruction>(V)) {
if (!I->getParent() || !I->getParent()->getParent())

View File

@ -146,7 +146,7 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
GV->hasExternalWeakLinkage())
return false;
if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility()))
if (GV && !GV->hasDefaultVisibility())
return true;
if (TT.isOSBinFormatMachO()) {

View File

@ -265,6 +265,7 @@ static Function *createClone(Function &F, Twine Suffix, coro::Shape &Shape,
SmallVector<ReturnInst *, 4> Returns;
CloneFunctionInto(NewF, &F, VMap, /*ModuleLevelChanges=*/true, Returns);
NewF->setDSOLocal(true);
// Remove old returns.
for (ReturnInst *Return : Returns)

View File

@ -2486,6 +2486,7 @@ OptimizeGlobalAliases(Module &M,
// Give the aliasee the name, linkage and other attributes of the alias.
Target->takeName(&*J);
Target->setLinkage(J->getLinkage());
Target->setDSOLocal(J->isDSOLocal());
Target->setVisibility(J->getVisibility());
Target->setDLLStorageClass(J->getDLLStorageClass());

View File

@ -50,7 +50,7 @@
; a reference to it when reached while earlier analyzing the phi using its
; return value:
; op0=Y op4=func2
; CHECK-DAG: <PERMODULE {{.*}} op0=8 op1=8 {{.*}} op4=0 op5=3/>
; CHECK-DAG: <PERMODULE {{.*}} op0=8 op1=72 {{.*}} op4=0 op5=3/>
; Function Z contains call to func2, and ensures we don't incorrectly add
; a reference to it when reached while analyzing subsequent use of its return
; value:

View File

@ -5,8 +5,8 @@
; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED
define private void @private()
; CHECK: <PERMODULE {{.*}} op1=8
; COMBINED-DAG: <COMBINED {{.*}} op2=8
; CHECK: <PERMODULE {{.*}} op1=72
; COMBINED-DAG: <COMBINED {{.*}} op2=72
{
ret void
}

View File

@ -4,10 +4,10 @@
; RUN: llvm-lto -thinlto -o %t2 %t.o
; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED
; Flags should be 0x17 (23) for local linkage (0x3) and not being importable
; Flags should be 0x57 (87) for local linkage (0x3), dso_local (0x40) and not being importable
; (0x10) due to local linkage plus having a section.
; CHECK: <PERMODULE {{.*}} op1=23
; COMBINED-DAG: <COMBINED {{.*}} op2=23
; CHECK: <PERMODULE {{.*}} op1=87
; COMBINED-DAG: <COMBINED {{.*}} op2=87
define internal void @functionWithSection() section "some_section" {
ret void
}

View File

@ -65,7 +65,7 @@ entry:
ret void
}
; CHECK: define amdgpu_kernel void @__test_block_invoke_kernel({{.*}}) #[[AT1:[0-9]+]]
; CHECK: define dso_local amdgpu_kernel void @__test_block_invoke_kernel({{.*}}) #[[AT1:[0-9]+]]
define internal amdgpu_kernel void @__test_block_invoke_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }> %arg) #0
!kernel_arg_addr_space !14 !kernel_arg_access_qual !15 !kernel_arg_type !16 !kernel_arg_base_type !16 !kernel_arg_type_qual !17 {
entry:
@ -77,7 +77,7 @@ entry:
declare i32 @__enqueue_kernel_basic(%opencl.queue_t addrspace(1)*, i32, %struct.ndrange_t*, i8 addrspace(4)*) local_unnamed_addr
; CHECK: define amdgpu_kernel void @__test_block_invoke_2_kernel({{.*}}) #[[AT2:[0-9]+]]
; CHECK: define dso_local amdgpu_kernel void @__test_block_invoke_2_kernel({{.*}}) #[[AT2:[0-9]+]]
define internal amdgpu_kernel void @__test_block_invoke_2_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*,
i64 addrspace(1)*, i64, i8 }> %arg) #0 !kernel_arg_addr_space !14 !kernel_arg_access_qual !15
!kernel_arg_type !16 !kernel_arg_base_type !16 !kernel_arg_type_qual !17 {

View File

@ -77,7 +77,7 @@ bb11:
; CHECK-NEXT: ret i32 42
; CHECK-NEXT: }
; CHECK: define internal dso_local i32 @f1.2(i8* %this) comdat($c2) {
; CHECK: define internal i32 @f1.2(i8* %this) comdat($c2) {
; CHECK-NEXT: bb20:
; CHECK-NEXT: store i8* %this, i8** null
; CHECK-NEXT: br label %bb21

View File

@ -13,12 +13,12 @@
; Ensure statics are promoted/renamed correctly from this file (all but
; constant variable need promotion).
; RUN: llvm-link %t.bc -summary-index=%t3.thinlto.bc -S | FileCheck %s --check-prefix=EXPORTSTATIC
; EXPORTSTATIC-DAG: @staticvar.llvm.{{.*}} = hidden global
; EXPORTSTATIC-DAG: @staticvar.llvm.{{.*}} = 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.{{.*}} = hidden global void ()* null
; EXPORTSTATIC-DAG: define hidden i32 @staticfunc.llvm.
; EXPORTSTATIC-DAG: define hidden void @staticfunc2.llvm.
; EXPORTSTATIC-DAG: @staticconstvar.llvm.0 = dso_local hidden unnamed_addr constant
; EXPORTSTATIC-DAG: @P.llvm.{{.*}} = dso_local hidden global void ()* null
; EXPORTSTATIC-DAG: define dso_local hidden i32 @staticfunc.llvm.
; EXPORTSTATIC-DAG: define dso_local hidden void @staticfunc2.llvm.
; Ensure that both weak alias to an imported function and strong alias to a
; non-imported function are correctly turned into declarations.
@ -67,13 +67,13 @@
; Ensure that imported static variable and function references are correctly
; promoted and renamed (including static constant variable).
; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=referencestatics:%t.bc -S | FileCheck %s --check-prefix=IMPORTSTATIC
; IMPORTSTATIC-DAG: @staticvar.llvm.{{.*}} = external hidden global
; IMPORTSTATIC-DAG: @staticvar.llvm.{{.*}} = external dso_local hidden global
; Eventually @staticconstvar can be imported as a copy
; IMPORTSTATIC-DAG: @staticconstvar.llvm.{{.*}} = external hidden unnamed_addr constant
; IMPORTSTATIC-DAG: @staticconstvar.llvm.{{.*}} = external dso_local hidden unnamed_addr constant
; IMPORTSTATIC-DAG: define available_externally i32 @referencestatics
; IMPORTSTATIC-DAG: %call = call i32 @staticfunc.llvm.
; IMPORTSTATIC-DAG: %0 = load i32, i32* @staticvar.llvm.
; IMPORTSTATIC-DAG: declare hidden i32 @staticfunc.llvm.
; IMPORTSTATIC-DAG: declare dso_local hidden i32 @staticfunc.llvm.
; Ensure that imported global (external) function and variable references
; are handled correctly (including referenced variable imported as
@ -90,7 +90,7 @@
; Ensure that imported static function pointer correctly promoted and renamed.
; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=callfuncptr:%t.bc -S | FileCheck %s --check-prefix=IMPORTFUNCPTR
; IMPORTFUNCPTR-DAG: @P.llvm.{{.*}} = external hidden global void ()*
; IMPORTFUNCPTR-DAG: @P.llvm.{{.*}} = external dso_local hidden global void ()*
; IMPORTFUNCPTR-DAG: define available_externally void @callfuncptr
; IMPORTFUNCPTR-DAG: %0 = load void ()*, void ()** @P.llvm.

View File

@ -7,13 +7,13 @@
; llvm-extract uses lazy bitcode loading, so make sure it correctly reads
; from bitcode files in addition to assembly files.
; CHECK: define hidden void @foo() comdat($x) {
; CHECK: define dso_local hidden void @foo() comdat($x) {
; CHECK: ret void
; CHECK: }
; The private linkage for foo() should be changed to external linkage and
; hidden visibility added.
; DELETE: declare hidden void @foo()
; DELETE: declare dso_local hidden void @foo()
; DELETE-NOT: comdat
; DELETE: define void @bar() {
; DELETE: call void @foo()

View File

@ -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()

View File

@ -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

View File

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

View File

@ -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.

View File

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

View File

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

View File

@ -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()

View File

@ -55,7 +55,7 @@ declare i32 @referencestatics(...) #1
; Ensure that the call is to the properly-renamed function.
; INSTLIMDEF-DAG: Import staticfunc
; INSTLIMDEF-DAG: %call = call i32 @staticfunc.llvm.
; INSTLIMDEF-DAG: define available_externally hidden i32 @staticfunc.llvm.{{.*}} !thinlto_src_module !0 {
; INSTLIMDEF-DAG: define available_externally dso_local hidden i32 @staticfunc.llvm.{{.*}} !thinlto_src_module !0 {
; INSTLIMDEF-DAG: Import referenceglobals
; CHECK-DAG: define available_externally i32 @referenceglobals(i32 %i) !thinlto_src_module !0 {
@ -80,7 +80,7 @@ declare void @callfuncptr(...) #1
; Ensure that all uses of local variable @P which has used in setfuncptr
; and callfuncptr are to the same promoted/renamed global.
; CHECK-DAG: @P.llvm.{{.*}} = external hidden global void ()*
; CHECK-DAG: @P.llvm.{{.*}} = external dso_local hidden global void ()*
; CHECK-DAG: %0 = load void ()*, void ()** @P.llvm.
; CHECK-DAG: store void ()* @staticfunc2.llvm.{{.*}}, void ()** @P.llvm.
@ -99,8 +99,8 @@ declare void @weakfunc(...) #1
declare void @linkoncefunc2(...) #1
; INSTLIMDEF-DAG: Import funcwithpersonality
; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.{{.*}}() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !thinlto_src_module !0 {
; INSTLIM5-DAG: declare hidden void @funcwithpersonality.llvm.{{.*}}()
; INSTLIMDEF-DAG: define available_externally dso_local hidden void @funcwithpersonality.llvm.{{.*}}() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !thinlto_src_module !0 {
; INSTLIM5-DAG: declare dso_local hidden void @funcwithpersonality.llvm.{{.*}}()
; CHECK-DAG: declare void @variadic(...)
declare void @variadic(...)

View File

@ -25,9 +25,9 @@ $nt = comdat any
; MERGED-SAME: comdat(${{"?lwt[^ ]+}})
@lwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($lwt), !type !0
; MERGED: {{@"?lwt_nl[^ ]+}} = hidden unnamed_addr global
; MERGED: {{@"?lwt_nl[^ ]+}} = dso_local hidden unnamed_addr global
; MERGED-SAME: comdat(${{"?lwt[^ ]+}})
; THIN: {{@"?lwt_nl[^ ]+}} = external hidden
; THIN: {{@"?lwt_nl[^ ]+}} = external dso_local hidden
@lwt_nl = internal unnamed_addr global i32 0, comdat($lwt)
; MERGED: @nlwt_aliasee = private unnamed_addr global
@ -47,11 +47,11 @@ $nt = comdat any
; THIN-SAME: comdat($nt)
@nt_nl = internal unnamed_addr global i32 0, comdat($nt)
; MERGED: {{@"?lwt[^ ]+}} = hidden unnamed_addr alias
; MERGED: {{@"?lwt[^ ]+}} = dso_local hidden unnamed_addr alias
; THIN: {{@"?lwt[^ ]+}} = external hidden
@lwt = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @lwt_aliasee
; MERGED: {{@"?nlwt_nl[^ ]+}} = hidden unnamed_addr alias
; MERGED: {{@"?nlwt_nl[^ ]+}} = dso_local hidden unnamed_addr alias
; THIN: {{@"?nlwt_nl[^ ]+}} = external hidden
@nlwt_nl = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @nlwt_aliasee

View File

@ -12,8 +12,8 @@
; BCA0: <GLOBALVAL_SUMMARY_BLOCK
; BCA1-NOT: <GLOBALVAL_SUMMARY_BLOCK
; M0: @"g$581d7631532fa146ba4061179da39272" = external hidden global i8{{$}}
; M1: @"g$581d7631532fa146ba4061179da39272" = hidden global i8 42, !type !0
; M0: @"g$581d7631532fa146ba4061179da39272" = external dso_local hidden global i8{{$}}
; M1: @"g$581d7631532fa146ba4061179da39272" = dso_local hidden global i8 42, !type !0
@g = internal global i8 42, !type !0
; M0: define i8* @f()

View File

@ -16,8 +16,8 @@
; M1: @g = global void ()* @"f$13757e0fb71915e385efa4dc9d1e08fd", !type !0
@g = global void ()* @f, !type !0
; M0: define hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
; M1: declare hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
; M0: define dso_local hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
; M1: declare dso_local hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
define internal void @f() {
call void @f2()
ret void

View File

@ -6,14 +6,14 @@ define [1 x i8*]* @source() {
ret [1 x i8*]* @g
}
; M0: @"g$84f59439b469192440047efc8de357fb" = external hidden constant [1 x i8*]{{$}}
; M1: @"g$84f59439b469192440047efc8de357fb" = hidden constant [1 x i8*] [i8* bitcast (i64 (i8*)* @"ok$84f59439b469192440047efc8de357fb" to i8*)]
; M0: @"g$84f59439b469192440047efc8de357fb" = external dso_local hidden constant [1 x i8*]{{$}}
; M1: @"g$84f59439b469192440047efc8de357fb" = dso_local hidden constant [1 x i8*] [i8* bitcast (i64 (i8*)* @"ok$84f59439b469192440047efc8de357fb" to i8*)]
@g = internal constant [1 x i8*] [
i8* bitcast (i64 (i8*)* @ok to i8*)
], !type !0
; M0: define hidden i64 @"ok$84f59439b469192440047efc8de357fb"
; M1: define available_externally hidden i64 @"ok$84f59439b469192440047efc8de357fb"
; M0: define dso_local hidden i64 @"ok$84f59439b469192440047efc8de357fb"
; M1: define available_externally dso_local hidden i64 @"ok$84f59439b469192440047efc8de357fb"
define internal i64 @ok(i8* %this) {
ret i64 42
}

View File

@ -81,12 +81,12 @@ define void @vf2(i8*) {
ret void
}
; CHECK: define hidden void @"vf3$merged"(i8*) {
; CHECK: define dso_local hidden void @"vf3$merged"(i8*) {
define internal void @vf3(i8*) {
ret void
}
; CHECK: define hidden void @"vf4$merged"(i8*) comdat {
; CHECK: define dso_local hidden void @"vf4$merged"(i8*) comdat {
define internal void @vf4(i8*) comdat {
ret void
}

View File

@ -11,7 +11,7 @@ define void @f() {
ret void
}
; CHECK: define internal dso_local void @g() {
; CHECK: define internal void @g() {
define hidden void @g() {
ret void
}

View File

@ -48,7 +48,7 @@ target triple = "x86_64-unknown-linux-gnu"
@g8 = external global i32
; CHECK-DAG: define internal dso_local void @f1()
; CHECK-DAG: define internal void @f1()
; OPT2-NOT: @f1
define hidden void @f1() {
ret void

View File

@ -45,7 +45,7 @@ target triple = "x86_64-unknown-linux-gnu"
; Confirm via a variable with a non-C identifier section that we are getting
; the expected internalization.
; CHECK-DAG: @var_with_nonC_section = internal dso_local global i32 0, section ".nonCsection"
; CHECK-DAG: @var_with_nonC_section = internal global i32 0, section ".nonCsection"
@var_with_nonC_section = global i32 0, section ".nonCsection"
; We should not internalize @deadfunc_with_section due to section
@ -57,7 +57,7 @@ define void @deadfunc_with_section() section "some_other_section" {
; Confirm via a function with a non-C identifier section that we are getting
; the expected internalization.
; CHECK-DAG: define internal dso_local void @deadfunc_with_nonC_section() section ".nonCsection"
; CHECK-DAG: define internal void @deadfunc_with_nonC_section() section ".nonCsection"
define void @deadfunc_with_nonC_section() section ".nonCsection" {
call void @deadfunc2_called_from_nonC_section()
ret void
@ -65,7 +65,7 @@ define void @deadfunc_with_nonC_section() section ".nonCsection" {
; In RegularLTO mode, where we have combined all the IR,
; @deadfunc2_called_from_section can be internalized.
; CHECK2-REGULARLTO: define internal dso_local void @deadfunc2_called_from_section
; CHECK2-REGULARLTO: define internal void @deadfunc2_called_from_section
; In ThinLTO mode, we can't internalize it as it needs to be preserved
; (due to the access from @deadfunc_with_section which must be preserved), and
; can't be internalized since the reference is from a different module.
@ -74,6 +74,6 @@ declare void @deadfunc2_called_from_section()
; Confirm when called from a function with a non-C identifier section that we
; are getting the expected internalization.
; CHECK2-REGULARLTO: define internal dso_local void @deadfunc2_called_from_nonC_section
; CHECK2-THINLTO: define internal dso_local void @deadfunc2_called_from_nonC_section
; CHECK2-REGULARLTO: define internal void @deadfunc2_called_from_nonC_section
; CHECK2-THINLTO: define internal void @deadfunc2_called_from_nonC_section
declare void @deadfunc2_called_from_nonC_section()

View File

@ -2,8 +2,8 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
; CHECK0: define hidden void @foo()
; CHECK1: declare hidden void @foo()
; CHECK0: define dso_local hidden void @foo()
; CHECK1: declare dso_local hidden void @foo()
define internal void @foo() {
call void @bar()
ret void

View File

@ -9,7 +9,7 @@
; The main and local_func must not be together.
; CHECK1: @a
; CHECK1: define i32 @main
; CHECK1: declare fastcc void @local_func
; CHECK1: declare dso_local fastcc void @local_func
@a = internal global i32 0, align 4
@global_storage = common global i32 0, align 4

View File

@ -4,9 +4,9 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare i32 @funInternal
; CHECK0: declare dso_local i32 @funInternal
; CHECK0: declare i32 @funExternal
; CHECK0: declare i32 @funInternal2
; CHECK0: declare dso_local i32 @funInternal2
; CHECK0: declare i32 @funExternal2
; All functions are in the same file.

View File

@ -5,9 +5,9 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare i32 @funInternal0
; CHECK0: declare i32 @funInternal1
; CHECK0: declare i32 @funInternal2
; CHECK0: declare dso_local i32 @funInternal0
; CHECK0: declare dso_local i32 @funInternal1
; CHECK0: declare dso_local i32 @funInternal2
; CHECK0: declare i32 @funExternal
; All functions are in the same file.

View File

@ -5,8 +5,8 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare i32 @fun1
; CHECK0: declare i32 @fun2
; CHECK0: declare dso_local i32 @fun1
; CHECK0: declare dso_local i32 @fun2
; CHECK0: declare i32 @fun3
; CHECK1: define internal i32 @fun1

View File

@ -5,8 +5,8 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare i32 @foo
; CHECK0: declare i32 @baz
; CHECK0: declare dso_local i32 @foo
; CHECK0: declare dso_local i32 @baz
; CHECK0: declare i32 @bar
; CHECK0: declare i32 @bar2

View File

@ -6,8 +6,8 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare i32 @funInternal0
; CHECK0: declare i32 @funInternal1
; CHECK0: declare dso_local i32 @funInternal0
; CHECK0: declare dso_local i32 @funInternal1
; CHECK0: declare i32 @funExternal0
; CHECK0: declare i32 @funExternal1

View File

@ -5,8 +5,8 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
; CHECK0: declare %struct.anon* @local0
; CHECK0: declare i8** @local1
; CHECK0: declare dso_local %struct.anon* @local0
; CHECK0: declare dso_local i8** @local1
; CHECK1: @bla
; CHECK1: @ptr

View File

@ -2,16 +2,16 @@
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
; CHECK0: declare hidden void @__llvmsplit_unnamed()
; CHECK1: define hidden void @__llvmsplit_unnamed()
; CHECK0: declare dso_local hidden void @__llvmsplit_unnamed()
; CHECK1: define dso_local hidden void @__llvmsplit_unnamed()
define internal void @0() {
; CHECK1: call void @foo()
call void @foo()
ret void
}
; CHECK0: declare hidden void @__llvmsplit_unnamed.1()
; CHECK1: define hidden void @__llvmsplit_unnamed.1()
; CHECK0: declare dso_local hidden void @__llvmsplit_unnamed.1()
; CHECK1: define dso_local hidden void @__llvmsplit_unnamed.1()
define internal void @1() {
; CHECK1: call void @foo()
; CHECK1: call void @foo()