[llvm-commits] [llvm] r48009 - /llvm/trunk/lib/Linker/LinkModules.cpp
Anton Korobeynikov
asl at math.spbu.ru
Fri Mar 7 10:32:19 PST 2008
Author: asl
Date: Fri Mar 7 12:32:18 2008
New Revision: 48009
URL: http://llvm.org/viewvc/llvm-project?rev=48009&view=rev
Log:
Small cleanup: propagate thread-localness via generic routine.
No functionality change.
Modified:
llvm/trunk/lib/Linker/LinkModules.cpp
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=48009&r1=48008&r2=48009&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Mar 7 12:32:18 2008
@@ -361,6 +361,9 @@
DestF->setParamAttrs(SrcF->getParamAttrs());
if (SrcF->hasCollector())
DestF->setCollector(SrcF->getCollector());
+ } else if (const GlobalVariable *SrcVar = dyn_cast<GlobalVariable>(SrcGV)) {
+ GlobalVariable *DestVar = cast<GlobalVariable>(DestGV);
+ DestVar->setThreadLocal(SrcVar->isThreadLocal());
}
}
@@ -488,7 +491,7 @@
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- SGV->getName(), Dest, SGV->isThreadLocal());
+ SGV->getName(), Dest);
// Propagate alignment, visibility and section info.
CopyGVAttributes(NewDGV, SGV);
@@ -511,9 +514,9 @@
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- "", Dest, SGV->isThreadLocal());
+ "", Dest);
- // Propagate alignment, section and visibility info.
+ // Propagate alignment, section and visibility info.
NewDGV->setAlignment(DGV->getAlignment());
CopyGVAttributes(NewDGV, SGV);
@@ -523,17 +526,17 @@
// Keep track that this is an appending variable...
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
} else {
+ // Otherwise, perform the mapping as instructed by GetLinkageResult.
+
// Propagate alignment, section, and visibility info.
CopyGVAttributes(DGV, SGV);
- // Otherwise, perform the mapping as instructed by GetLinkageResult. If
- // the types don't match, and if we are to link from the source, nuke DGV
- // and create a new one of the appropriate type.
+ // If the types don't match, and if we are to link from the source, nuke
+ // DGV and create a new one of the appropriate type.
if (SGV->getType() != DGV->getType() && LinkFromSrc) {
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
DGV->isConstant(), DGV->getLinkage());
- NewDGV->setThreadLocal(DGV->isThreadLocal());
CopyGVAttributes(NewDGV, DGV);
Dest->getGlobalList().insert(DGV, NewDGV);
DGV->replaceAllUsesWith(
More information about the llvm-commits
mailing list