[llvm] r258362 - Simplify the logic. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 20 14:38:24 PST 2016
Author: rafael
Date: Wed Jan 20 16:38:23 2016
New Revision: 258362
URL: http://llvm.org/viewvc/llvm-project?rev=258362&view=rev
Log:
Simplify the logic. NFC.
Found while reviewing the change for PR26152.
Modified:
llvm/trunk/lib/Linker/IRMover.cpp
Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=258362&r1=258361&r2=258362&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Wed Jan 20 16:38:23 2016
@@ -1005,23 +1005,6 @@ Constant *IRLinker::linkAppendingVarProt
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 *D
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
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
More information about the llvm-commits
mailing list