r322318 - Make internal/private GVs implicitly dso_local.

Rafael Espindola via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 14:15:13 PST 2018


Author: rafael
Date: Thu Jan 11 14:15:12 2018
New Revision: 322318

URL: http://llvm.org/viewvc/llvm-project?rev=322318&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
    cfe/trunk/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
    cfe/trunk/test/OpenMP/target_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_parallel_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_parallel_for_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_simd_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_teams_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_teams_distribute_codegen_registration.cpp
    cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Jan 11 14:15:12 2018
@@ -5912,6 +5912,7 @@ void CGOpenMPRuntime::emitTargetOutlined
   if (CGM.getLangOpts().OpenMPIsDevice) {
     OutlinedFnID = llvm::ConstantExpr::getBitCast(OutlinedFn, CGM.Int8PtrTy);
     OutlinedFn->setLinkage(llvm::GlobalValue::ExternalLinkage);
+    OutlinedFn->setDSOLocal(false);
   } else
     OutlinedFnID = new llvm::GlobalVariable(
         CGM.getModule(), CGM.Int8Ty, /*isConstant=*/true,

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-static-initializers.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-static-initializers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-static-initializers.cpp Thu Jan 11 14:15:12 2018
@@ -28,11 +28,11 @@ S s;
 // See @llvm.global_ctors above.
 __declspec(selectany) S selectany1;
 __declspec(selectany) S selectany2;
-// CHECK: define linkonce_odr void @"\01??__Eselectany1@@YAXXZ"() {{.*}} comdat
+// CHECK: define linkonce_odr dso_local void @"\01??__Eselectany1@@YAXXZ"() {{.*}} comdat
 // CHECK-NOT: @"\01??_Bselectany1
 // CHECK: call x86_thiscallcc %struct.S* @"\01??0S@@QAE at XZ"
 // CHECK: ret void
-// CHECK: define linkonce_odr void @"\01??__Eselectany2@@YAXXZ"() {{.*}} comdat
+// CHECK: define linkonce_odr dso_local void @"\01??__Eselectany2@@YAXXZ"() {{.*}} comdat
 // CHECK-NOT: @"\01??_Bselectany2
 // CHECK: call x86_thiscallcc %struct.S* @"\01??0S@@QAE at XZ"
 // CHECK: ret void
@@ -231,7 +231,7 @@ void force_usage() {
   DynamicDLLImportInitVSMangling::switch_test3();
 }
 
-// CHECK: define linkonce_odr void @"\01??__Efoo@?$B at H@@2VA@@A at YAXXZ"() {{.*}} comdat
+// CHECK: define linkonce_odr dso_local void @"\01??__Efoo@?$B at H@@2VA@@A at YAXXZ"() {{.*}} comdat
 // CHECK-NOT: and
 // CHECK-NOT: ?_Bfoo@
 // CHECK: call x86_thiscallcc %class.A* @"\01??0A@@QAE at XZ"

Modified: cfe/trunk/test/OpenMP/target_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -393,7 +393,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_parallel_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -393,7 +393,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_parallel_for_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_for_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_for_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -402,7 +402,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -402,7 +402,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_simd_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_simd_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_simd_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_simd_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -402,7 +402,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_teams_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -393,7 +393,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_teams_distribute_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -402,7 +402,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),

Modified: cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp?rev=322318&r1=322317&r2=322318&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp Thu Jan 11 14:15:12 2018
@@ -402,7 +402,7 @@ struct ST {
 //CHECK:     ret void
 //CHECK:     declare i32 @__tgt_unregister_lib([[DSCTY]]*)
 
-//CHECK:     define linkonce hidden void @[[REGFN]](i8*)
+//CHECK:     define linkonce dso_local hidden void @[[REGFN]](i8*)
 //CHECK-SAME: comdat {
 //CHECK:     call i32 @__tgt_register_lib([[DSCTY]]* [[DESC]])
 //CHECK:     call i32 @__cxa_atexit(void (i8*)* @[[UNREGFN]], i8* bitcast ([[DSCTY]]* [[DESC]] to i8*),




More information about the cfe-commits mailing list