forked from OSchip/llvm-project
Don't change the visibility when converting a definition to a declaration.
llvm-svn: 242030
This commit is contained in:
parent
ef5aa29e12
commit
237c3a6def
|
@ -176,6 +176,7 @@ namespace {
|
|||
(void) llvm::createStraightLineStrengthReducePass();
|
||||
(void) llvm::createMemDerefPrinter();
|
||||
(void) llvm::createFloat2IntPass();
|
||||
(void) llvm::createEliminateAvailableExternallyPass();
|
||||
|
||||
(void)new llvm::IntervalPartition();
|
||||
(void)new llvm::ScalarEvolution();
|
||||
|
|
|
@ -67,7 +67,6 @@ bool EliminateAvailableExternally::runOnModule(Module &M) {
|
|||
}
|
||||
I->removeDeadConstantUsers();
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
I->setVisibility(GlobalValue::DefaultVisibility);
|
||||
NumVariables++;
|
||||
}
|
||||
|
||||
|
@ -78,7 +77,6 @@ bool EliminateAvailableExternally::runOnModule(Module &M) {
|
|||
if (!I->isDeclaration())
|
||||
// This will set the linkage to external
|
||||
I->deleteBody();
|
||||
I->setVisibility(GlobalValue::DefaultVisibility);
|
||||
I->removeDeadConstantUsers();
|
||||
NumFunctions++;
|
||||
}
|
||||
|
@ -91,7 +89,6 @@ bool EliminateAvailableExternally::runOnModule(Module &M) {
|
|||
I->setAliasee(nullptr);
|
||||
I->removeDeadConstantUsers();
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
I->setVisibility(GlobalValue::DefaultVisibility);
|
||||
NumAliases++;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ void llvm::initializeIPO(PassRegistry &Registry) {
|
|||
initializeStripDeadDebugInfoPass(Registry);
|
||||
initializeStripNonDebugSymbolsPass(Registry);
|
||||
initializeBarrierNoopPass(Registry);
|
||||
initializeEliminateAvailableExternallyPass(Registry);
|
||||
}
|
||||
|
||||
void LLVMInitializeIPO(LLVMPassRegistryRef R) {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
; RUN: opt -elim-avail-extern -S < %s | FileCheck %s
|
||||
|
||||
; CHECK: declare hidden void @f()
|
||||
define available_externally hidden void @f() {
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @g() {
|
||||
call void @f()
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue