[llvm-commits] [llvm] r159272 - in /llvm/trunk: include/llvm/GlobalValue.h lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/hidden.ll
Matt Beaumont-Gay
matthewbg at google.com
Wed Jun 27 10:10:33 PDT 2012
Author: matthewbg
Date: Wed Jun 27 12:10:33 2012
New Revision: 159272
URL: http://llvm.org/viewvc/llvm-project?rev=159272&view=rev
Log:
Revert r159136 due to PR13124.
Original commit message:
If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.
Removed:
llvm/trunk/test/Transforms/GlobalOpt/hidden.ll
Modified:
llvm/trunk/include/llvm/GlobalValue.h
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/trunk/include/llvm/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=159272&r1=159271&r2=159272&view=diff
==============================================================================
--- llvm/trunk/include/llvm/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/GlobalValue.h Wed Jun 27 12:10:33 2012
@@ -122,9 +122,6 @@
static bool isAvailableExternallyLinkage(LinkageTypes Linkage) {
return Linkage == AvailableExternallyLinkage;
}
- static bool isLinkOnceODRLinkage(LinkageTypes Linkage) {
- return Linkage == LinkOnceODRLinkage;
- }
static bool isLinkOnceLinkage(LinkageTypes Linkage) {
return Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceODRLinkage;
}
@@ -205,9 +202,6 @@
bool hasAvailableExternallyLinkage() const {
return isAvailableExternallyLinkage(Linkage);
}
- bool hasLinkOnceODRLinkage() const {
- return isLinkOnceODRLinkage(Linkage);
- }
bool hasLinkOnceLinkage() const {
return isLinkOnceLinkage(Linkage);
}
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=159272&r1=159271&r2=159272&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Jun 27 12:10:33 2012
@@ -1731,12 +1731,6 @@
return true;
}
- if (GV->hasLinkOnceODRLinkage() && GV->hasUnnamedAddr() && GV->isConstant() &&
- GV->getVisibility() != GlobalValue::HiddenVisibility) {
- GV->setVisibility(GlobalValue::HiddenVisibility);
- return true;
- }
-
if (!GV->hasLocalLinkage())
return false;
@@ -1749,7 +1743,6 @@
if (!GS.isCompared && !GV->hasUnnamedAddr()) {
GV->setUnnamedAddr(true);
NumUnnamed++;
- return true;
}
if (GV->isConstant() || !GV->hasInitializer())
@@ -1924,10 +1917,6 @@
F->eraseFromParent();
Changed = true;
++NumFnDeleted;
- } else if (F->hasLinkOnceODRLinkage() && F->hasUnnamedAddr() &&
- F->getVisibility() != GlobalValue::HiddenVisibility) {
- F->setVisibility(GlobalValue::HiddenVisibility);
- Changed = true;
} else if (F->hasLocalLinkage()) {
if (F->getCallingConv() == CallingConv::C && !F->isVarArg() &&
!F->hasAddressTaken()) {
Removed: llvm/trunk/test/Transforms/GlobalOpt/hidden.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/hidden.ll?rev=159271&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/hidden.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/hidden.ll (removed)
@@ -1,14 +0,0 @@
-; RUN: opt %s -globalopt -S | FileCheck %s
-
- at foo = linkonce_odr unnamed_addr constant i32 42
-; CHECK: @foo = linkonce_odr hidden unnamed_addr constant i32 42
-
-define linkonce_odr void @bar() unnamed_addr {
-; CHECK: define linkonce_odr hidden void @bar() unnamed_addr {
- ret void
-}
-
-define i32* @zed() {
- call void @bar()
- ret i32* @foo
-}
More information about the llvm-commits
mailing list