diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /llvm/lib/Linker/IRMover.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) |
Notes
Diffstat (limited to 'llvm/lib/Linker/IRMover.cpp')
-rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 6784d81595e5b..e13656ed1c106 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -628,7 +628,7 @@ GlobalVariable *IRLinker::copyGlobalVariableProto(const GlobalVariable *SGVar) { SGVar->isConstant(), GlobalValue::ExternalLinkage, /*init*/ nullptr, SGVar->getName(), /*insertbefore*/ nullptr, SGVar->getThreadLocalMode(), - SGVar->getType()->getAddressSpace()); + SGVar->getAddressSpace()); NewDGV->setAlignment(MaybeAlign(SGVar->getAlignment())); NewDGV->copyAttributesFrom(SGVar); return NewDGV; @@ -654,9 +654,9 @@ AttributeList IRLinker::mapAttributeTypes(LLVMContext &C, AttributeList Attrs) { Function *IRLinker::copyFunctionProto(const Function *SF) { // If there is no linkage to be performed or we are linking from the source, // bring SF over. - auto *F = - Function::Create(TypeMap.get(SF->getFunctionType()), - GlobalValue::ExternalLinkage, SF->getName(), &DstM); + auto *F = Function::Create(TypeMap.get(SF->getFunctionType()), + GlobalValue::ExternalLinkage, + SF->getAddressSpace(), SF->getName(), &DstM); F->copyAttributesFrom(SF); F->setAttributes(mapAttributeTypes(F->getContext(), F->getAttributes())); return F; @@ -671,11 +671,11 @@ IRLinker::copyGlobalIndirectSymbolProto(const GlobalIndirectSymbol *SGIS) { auto *Ty = TypeMap.get(SGIS->getValueType()); GlobalIndirectSymbol *GIS; if (isa<GlobalAlias>(SGIS)) - GIS = GlobalAlias::create(Ty, SGIS->getType()->getPointerAddressSpace(), + GIS = GlobalAlias::create(Ty, SGIS->getAddressSpace(), GlobalValue::ExternalLinkage, SGIS->getName(), &DstM); else - GIS = GlobalIFunc::create(Ty, SGIS->getType()->getPointerAddressSpace(), + GIS = GlobalIFunc::create(Ty, SGIS->getAddressSpace(), GlobalValue::ExternalLinkage, SGIS->getName(), nullptr, &DstM); GIS->copyAttributesFrom(SGIS); @@ -695,14 +695,15 @@ GlobalValue *IRLinker::copyGlobalValueProto(const GlobalValue *SGV, else if (SGV->getValueType()->isFunctionTy()) NewGV = Function::Create(cast<FunctionType>(TypeMap.get(SGV->getValueType())), - GlobalValue::ExternalLinkage, SGV->getName(), &DstM); + GlobalValue::ExternalLinkage, SGV->getAddressSpace(), + SGV->getName(), &DstM); else - NewGV = new GlobalVariable( - DstM, TypeMap.get(SGV->getValueType()), - /*isConstant*/ false, GlobalValue::ExternalLinkage, - /*init*/ nullptr, SGV->getName(), - /*insertbefore*/ nullptr, SGV->getThreadLocalMode(), - SGV->getType()->getAddressSpace()); + NewGV = + new GlobalVariable(DstM, TypeMap.get(SGV->getValueType()), + /*isConstant*/ false, GlobalValue::ExternalLinkage, + /*init*/ nullptr, SGV->getName(), + /*insertbefore*/ nullptr, + SGV->getThreadLocalMode(), SGV->getAddressSpace()); } if (ForDefinition) @@ -918,7 +919,7 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, GlobalVariable *NG = new GlobalVariable( DstM, NewType, SrcGV->isConstant(), SrcGV->getLinkage(), /*init*/ nullptr, /*name*/ "", DstGV, SrcGV->getThreadLocalMode(), - SrcGV->getType()->getAddressSpace()); + SrcGV->getAddressSpace()); NG->copyAttributesFrom(SrcGV); forceRenaming(NG, SrcGV->getName()); @@ -1098,7 +1099,7 @@ Error IRLinker::linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src) { } void IRLinker::flushRAUWWorklist() { - for (const auto Elem : RAUWWorklist) { + for (const auto &Elem : RAUWWorklist) { GlobalValue *Old; Value *New; std::tie(Old, New) = Elem; |