diff --git a/clang/test/OpenMP/target_globals_codegen.cpp b/clang/test/OpenMP/target_globals_codegen.cpp --- a/clang/test/OpenMP/target_globals_codegen.cpp +++ b/clang/test/OpenMP/target_globals_codegen.cpp @@ -12,25 +12,25 @@ #define HEADER //. -// CHECK: @__omp_rtl_debug_kind = weak_odr constant i32 1 -// CHECK: @__omp_rtl_assume_teams_oversubscription = weak_odr constant i32 0 -// CHECK: @__omp_rtl_assume_threads_oversubscription = weak_odr constant i32 0 +// CHECK: @__omp_rtl_debug_kind = weak_odr hidden constant i32 1 +// CHECK: @__omp_rtl_assume_teams_oversubscription = weak_odr hidden constant i32 0 +// CHECK: @__omp_rtl_assume_threads_oversubscription = weak_odr hidden constant i32 0 //. -// CHECK-EQ: @__omp_rtl_debug_kind = weak_odr constant i32 111 -// CHECK-EQ: @__omp_rtl_assume_teams_oversubscription = weak_odr constant i32 0 -// CHECK-EQ: @__omp_rtl_assume_threads_oversubscription = weak_odr constant i32 0 +// CHECK-EQ: @__omp_rtl_debug_kind = weak_odr hidden constant i32 111 +// CHECK-EQ: @__omp_rtl_assume_teams_oversubscription = weak_odr hidden constant i32 0 +// CHECK-EQ: @__omp_rtl_assume_threads_oversubscription = weak_odr hidden constant i32 0 //. -// CHECK-DEFAULT: @__omp_rtl_debug_kind = weak_odr constant i32 0 -// CHECK-DEFAULT: @__omp_rtl_assume_teams_oversubscription = weak_odr constant i32 0 -// CHECK-DEFAULT: @__omp_rtl_assume_threads_oversubscription = weak_odr constant i32 0 +// CHECK-DEFAULT: @__omp_rtl_debug_kind = weak_odr hidden constant i32 0 +// CHECK-DEFAULT: @__omp_rtl_assume_teams_oversubscription = weak_odr hidden constant i32 0 +// CHECK-DEFAULT: @__omp_rtl_assume_threads_oversubscription = weak_odr hidden constant i32 0 //. -// CHECK-THREADS: @__omp_rtl_debug_kind = weak_odr constant i32 0 -// CHECK-THREADS: @__omp_rtl_assume_teams_oversubscription = weak_odr constant i32 0 -// CHECK-THREADS: @__omp_rtl_assume_threads_oversubscription = weak_odr constant i32 1 +// CHECK-THREADS: @__omp_rtl_debug_kind = weak_odr hidden constant i32 0 +// CHECK-THREADS: @__omp_rtl_assume_teams_oversubscription = weak_odr hidden constant i32 0 +// CHECK-THREADS: @__omp_rtl_assume_threads_oversubscription = weak_odr hidden constant i32 1 //. -// CHECK-TEAMS: @__omp_rtl_debug_kind = weak_odr constant i32 0 -// CHECK-TEAMS: @__omp_rtl_assume_teams_oversubscription = weak_odr constant i32 1 -// CHECK-TEAMS: @__omp_rtl_assume_threads_oversubscription = weak_odr constant i32 0 +// CHECK-TEAMS: @__omp_rtl_debug_kind = weak_odr hidden constant i32 0 +// CHECK-TEAMS: @__omp_rtl_assume_teams_oversubscription = weak_odr hidden constant i32 1 +// CHECK-TEAMS: @__omp_rtl_assume_threads_oversubscription = weak_odr hidden constant i32 0 //. void foo() { #pragma omp target diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -689,7 +689,8 @@ omp::IdentFlag Flags = omp::IdentFlag(0), unsigned Reserve2Flags = 0); - /// Create a global flag \p Namein the module with initial value \p Value. + /// Create a hidden global flag \p Name in the module with initial value \p + /// Value. GlobalValue *createGlobalFlag(unsigned Value, StringRef Name); /// Generate control flow and cleanup for cancellation. diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -254,6 +254,7 @@ new GlobalVariable(M, I32Ty, /* isConstant = */ true, GlobalValue::WeakODRLinkage, ConstantInt::get(I32Ty, Value), Name); + GV->setVisibility(GlobalValue::HiddenVisibility); return GV; }