[llvm] deb82d4 - Revert "[PGO] Make emitted symbols hidden"

Alex Brachet via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 07:39:34 PDT 2022


Author: Alex Brachet
Date: 2022-10-10T14:37:59Z
New Revision: deb82d4a20150b4c983ed02adcfd2ca84691b74b

URL: https://github.com/llvm/llvm-project/commit/deb82d4a20150b4c983ed02adcfd2ca84691b74b
DIFF: https://github.com/llvm/llvm-project/commit/deb82d4a20150b4c983ed02adcfd2ca84691b74b.diff

LOG: Revert "[PGO] Make emitted symbols hidden"

This reverts commit 4ea1a647ff0973c683dd71fec77e6fe7f6dfd2ca.

This breaks on Darwin which tries to export these symbols
https://github.com/llvm/llvm-project/blob/ebb258d3b0785f6dcc65e1f277d0690891ddc94d/clang/lib/Driver/ToolChains/Darwin.cpp#L1363

I'll try to reland which that removed and approval from
Apple folks.

Added: 
    

Modified: 
    llvm/lib/ProfileData/InstrProf.cpp
    llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    llvm/test/Transforms/PGOProfile/branch1.ll
    llvm/test/Transforms/PGOProfile/branch2.ll
    llvm/test/Transforms/PGOProfile/comdat_internal.ll
    llvm/test/Transforms/PGOProfile/criticaledge.ll
    llvm/test/Transforms/PGOProfile/instr_entry_bb.ll
    llvm/test/Transforms/PGOProfile/landingpad.ll
    llvm/test/Transforms/PGOProfile/loop1.ll
    llvm/test/Transforms/PGOProfile/loop2.ll
    llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll
    llvm/test/Transforms/PGOProfile/single_bb.ll
    llvm/test/Transforms/PGOProfile/switch.ll
    llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll

Removed: 
    llvm/test/Transforms/PGOProfile/filename.ll


################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index eab1eab82ac2f..9c04bcb8416f5 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -1210,7 +1210,6 @@ void createProfileFileNameVar(Module &M, StringRef InstrProfileOutput) {
   GlobalVariable *ProfileNameVar = new GlobalVariable(
       M, ProfileNameConst->getType(), true, GlobalValue::WeakAnyLinkage,
       ProfileNameConst, INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_NAME_VAR));
-  ProfileNameVar->setVisibility(GlobalValue::HiddenVisibility);
   Triple TT(M.getTargetTriple());
   if (TT.supportsCOMDAT()) {
     ProfileNameVar->setLinkage(GlobalValue::ExternalLinkage);

diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index cd50c97564082..6bb29a0f34acf 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -380,7 +380,7 @@ static GlobalVariable *createIRLevelProfileFlagVar(Module &M, bool IsCS) {
   auto IRLevelVersionVariable = new GlobalVariable(
       M, IntTy64, true, GlobalValue::WeakAnyLinkage,
       Constant::getIntegerValue(IntTy64, APInt(64, ProfileVersion)), VarName);
-  IRLevelVersionVariable->setVisibility(GlobalValue::HiddenVisibility);
+  IRLevelVersionVariable->setVisibility(GlobalValue::DefaultVisibility);
   Triple TT(M.getTargetTriple());
   if (TT.supportsCOMDAT()) {
     IRLevelVersionVariable->setLinkage(GlobalValue::ExternalLinkage);

diff  --git a/llvm/test/Transforms/PGOProfile/branch1.ll b/llvm/test/Transforms/PGOProfile/branch1.ll
index 22c4fd5d3c10f..7ec23d08ea5eb 100644
--- a/llvm/test/Transforms/PGOProfile/branch1.ll
+++ b/llvm/test/Transforms/PGOProfile/branch1.ll
@@ -14,7 +14,7 @@ target triple = "x86_64-unknown-linux-gnu"
 ; GEN-DARWIN-LINKONCE: target triple = "x86_64-apple-darwin"
 
 ; GEN-COMDAT: $__llvm_profile_raw_version = comdat any
-; GEN-COMDAT: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN-COMDAT: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN-LINKONCE: @__llvm_profile_raw_version = linkonce constant i64 {{[0-9]+}}
 ; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1"
 

diff  --git a/llvm/test/Transforms/PGOProfile/branch2.ll b/llvm/test/Transforms/PGOProfile/branch2.ll
index 82478e75cb262..b65020d1557bf 100644
--- a/llvm/test/Transforms/PGOProfile/branch2.ll
+++ b/llvm/test/Transforms/PGOProfile/branch2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_br_2 = private constant [9 x i8] c"test_br_2"
 
 define i32 @test_br_2(i32 %i) {

diff  --git a/llvm/test/Transforms/PGOProfile/comdat_internal.ll b/llvm/test/Transforms/PGOProfile/comdat_internal.ll
index a1cf115f910ad..64274a33999df 100644
--- a/llvm/test/Transforms/PGOProfile/comdat_internal.ll
+++ b/llvm/test/Transforms/PGOProfile/comdat_internal.ll
@@ -10,7 +10,7 @@ $foo = comdat any
 
 @bar = global ptr @foo, align 8
 
-; CHECK: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; CHECK: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; CHECK-NOT: __profn__stdin__foo
 ; CHECK: @__profc__stdin__foo.[[#FOO_HASH]] = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", comdat, align 8
 ; CHECK: @__profd__stdin__foo.[[#FOO_HASH]] = private global { i64, i64, i64, ptr, ptr, i32, [2 x i16] } { i64 -5640069336071256030, i64 [[#FOO_HASH]], i64 sub (i64 ptrtoint (ptr @__profc__stdin__foo.742261418966908927 to i64), i64 ptrtoint (ptr @__profd__stdin__foo.742261418966908927 to i64)), ptr null

diff  --git a/llvm/test/Transforms/PGOProfile/criticaledge.ll b/llvm/test/Transforms/PGOProfile/criticaledge.ll
index 616d0fa3a4cf2..4264b03c23d12 100644
--- a/llvm/test/Transforms/PGOProfile/criticaledge.ll
+++ b/llvm/test/Transforms/PGOProfile/criticaledge.ll
@@ -9,7 +9,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_criticalEdge = private constant [17 x i8] c"test_criticalEdge"
 ; GEN: @__profn__stdin__bar = private constant [11 x i8] c"<stdin>:bar"
 

diff  --git a/llvm/test/Transforms/PGOProfile/filename.ll b/llvm/test/Transforms/PGOProfile/filename.ll
deleted file mode 100644
index 43bc4a592e174..0000000000000
--- a/llvm/test/Transforms/PGOProfile/filename.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: opt < %s -passes='thinlto-pre-link<O2>' --cs-profilegen-file=file -cspgo-kind=cspgo-instr-gen-pipeline -S | FileCheck %s
-
-; CHECK: $__llvm_profile_filename = comdat any
-; CHECK: @__llvm_profile_filename = hidden local_unnamed_addr constant [5 x i8] c"file\00", comdat
-
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @test() {
-  ret i32 0
-}

diff  --git a/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll b/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll
index ee088674e35e2..e1380a0edf0e1 100644
--- a/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll
+++ b/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll
@@ -7,7 +7,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_br_2 = private constant [9 x i8] c"test_br_2"
 
 define i32 @test_br_2(i32 %i) {

diff  --git a/llvm/test/Transforms/PGOProfile/landingpad.ll b/llvm/test/Transforms/PGOProfile/landingpad.ll
index e16bad5122778..1b2648fc2ff64 100644
--- a/llvm/test/Transforms/PGOProfile/landingpad.ll
+++ b/llvm/test/Transforms/PGOProfile/landingpad.ll
@@ -11,7 +11,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @val = global i32 0, align 4
 @_ZTIi = external constant ptr
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_bar = private constant [3 x i8] c"bar"
 ; GEN: @__profn_foo = private constant [3 x i8] c"foo"
 

diff  --git a/llvm/test/Transforms/PGOProfile/loop1.ll b/llvm/test/Transforms/PGOProfile/loop1.ll
index ece7ea21b8ee5..86029663bf8e1 100644
--- a/llvm/test/Transforms/PGOProfile/loop1.ll
+++ b/llvm/test/Transforms/PGOProfile/loop1.ll
@@ -9,7 +9,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_simple_for = private constant [15 x i8] c"test_simple_for"
 
 define i32 @test_simple_for(i32 %n) {

diff  --git a/llvm/test/Transforms/PGOProfile/loop2.ll b/llvm/test/Transforms/PGOProfile/loop2.ll
index 071f8a6d5ad59..13725ec097546 100644
--- a/llvm/test/Transforms/PGOProfile/loop2.ll
+++ b/llvm/test/Transforms/PGOProfile/loop2.ll
@@ -8,7 +8,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for"
 
 define i32 @test_nested_for(i32 %r, i32 %s) {

diff  --git a/llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll b/llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll
index 19f68bf30c809..8ea2d3ccbfe07 100644
--- a/llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll
+++ b/llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll
@@ -11,11 +11,11 @@
 ; RUN: llvm-dis %t.0.0.preopt.bc -o - | FileCheck %s --check-prefix=IRPGOBE
 
 ;; Before LTO, we should have the __llvm_profile_raw_version definition.
-; IRPGOPRE: @__llvm_profile_raw_version = hidden constant i64
+; IRPGOPRE: @__llvm_profile_raw_version = constant i64
 
 ;; Non-prevailing __llvm_profile_raw_version is discarded by LTO. Ensure the
 ;; declaration is retained.
-; IRPGOBE: @__llvm_profile_raw_version = external hidden constant i64
+; IRPGOBE: @__llvm_profile_raw_version = external constant i64
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/llvm/test/Transforms/PGOProfile/single_bb.ll b/llvm/test/Transforms/PGOProfile/single_bb.ll
index b6d85ed084018..f60cbfe565e19 100644
--- a/llvm/test/Transforms/PGOProfile/single_bb.ll
+++ b/llvm/test/Transforms/PGOProfile/single_bb.ll
@@ -3,7 +3,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_single_bb = private constant [9 x i8] c"single_bb"
 
 define i32 @single_bb() {

diff  --git a/llvm/test/Transforms/PGOProfile/switch.ll b/llvm/test/Transforms/PGOProfile/switch.ll
index b0b32182b5baa..dac4347a729d0 100644
--- a/llvm/test/Transforms/PGOProfile/switch.ll
+++ b/llvm/test/Transforms/PGOProfile/switch.ll
@@ -8,7 +8,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 ; GEN: $__llvm_profile_raw_version = comdat any
-; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
+; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
 ; GEN: @__profn_test_switch = private constant [11 x i8] c"test_switch"
 
 define void @test_switch(i32 %i) {

diff  --git a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll b/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll
index 266e2597a63a2..8a408fa842fb5 100644
--- a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll
+++ b/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll
@@ -17,11 +17,11 @@
 ; RUN: llvm-dis %t.2.4.opt.bc -o - | FileCheck %s --check-prefixes=CSGEN,NOPREVAILING
 
 ;; Prevailing __llvm_profile_raw_version is kept by LTO.
-; PREVAILING: @__llvm_profile_raw_version = hidden constant i64
+; PREVAILING: @__llvm_profile_raw_version = constant i64
 
 ;; Non-prevailing __llvm_profile_raw_version is discarded by LTO. Ensure the
 ;; declaration is retained.
-; NOPREVAILING: @__llvm_profile_raw_version = external hidden constant i64
+; NOPREVAILING: @__llvm_profile_raw_version = external constant i64
 ; CSGEN: @__profc_
 ; CSGEN: @__profd_
 


        


More information about the llvm-commits mailing list