summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-01-20 22:38:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-01-20 22:38:23 +0000
commit55a7ae5cc7f949b8318deb3ad19c249a207286eb (patch)
tree27c1fc9eae8fbfa0aaf442250e0e22991a3e9d30 /llvm/lib
parent4e3b446ae875799f3ded6cddc4768028136d1ee9 (diff)
downloadbcm5719-llvm-55a7ae5cc7f949b8318deb3ad19c249a207286eb.tar.gz
bcm5719-llvm-55a7ae5cc7f949b8318deb3ad19c249a207286eb.zip
Simplify the logic. NFC.
Found while reviewing the change for PR26152. llvm-svn: 258362
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Linker/IRMover.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 9fdf8ca6b24..f1b04577534 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -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
OpenPOWER on IntegriCloud