mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-03 17:32:59 +00:00
Simplify the logic. NFC.
Found while reviewing the change for PR26152. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258362 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
397090c163
commit
74569533c9
@ -1005,23 +1005,6 @@ Constant *IRLinker::linkAppendingVarProto(GlobalVariable *DstGV,
|
||||
return Ret;
|
||||
}
|
||||
|
||||
static bool useExistingDest(GlobalValue &SGV, GlobalValue *DGV,
|
||||
bool ShouldLink) {
|
||||
if (!DGV)
|
||||
return false;
|
||||
|
||||
if (SGV.isDeclaration())
|
||||
return true;
|
||||
|
||||
if (DGV->isDeclarationForLinker() && !SGV.isDeclarationForLinker())
|
||||
return false;
|
||||
|
||||
if (ShouldLink)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IRLinker::shouldLink(GlobalValue *DGV, GlobalValue &SGV) {
|
||||
// Already imported all the values. Just map to the Dest value
|
||||
// in case it is referenced in the metadata.
|
||||
@ -1037,7 +1020,7 @@ bool IRLinker::shouldLink(GlobalValue *DGV, GlobalValue &SGV) {
|
||||
if (SGV.hasLocalLinkage())
|
||||
return true;
|
||||
|
||||
if (DGV && !DGV->isDeclaration())
|
||||
if (DGV && !DGV->isDeclarationForLinker())
|
||||
return false;
|
||||
|
||||
if (SGV.hasAvailableExternallyLinkage())
|
||||
@ -1077,7 +1060,7 @@ Constant *IRLinker::linkGlobalValueProto(GlobalValue *SGV, bool ForAlias) {
|
||||
cast<GlobalVariable>(SGV));
|
||||
|
||||
GlobalValue *NewGV;
|
||||
if (useExistingDest(*SGV, DGV, ShouldLink)) {
|
||||
if (DGV && !ShouldLink) {
|
||||
NewGV = DGV;
|
||||
} else {
|
||||
// If we are done linking global value bodies (i.e. we are performing
|
||||
|
Loading…
Reference in New Issue
Block a user