diff options
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 8dd59f9e0e3..de368498ef2 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -719,7 +719,7 @@ GlobalVariable *IRLinker::copyGlobalVariableProto(const GlobalVariable *SGVar) { // identical version of the symbol over in the dest module... the // initializer will be filled in later by LinkGlobalInits. GlobalVariable *NewDGV = - new GlobalVariable(DstM, TypeMap.get(SGVar->getType()->getElementType()), + new GlobalVariable(DstM, TypeMap.get(SGVar->getValueType()), SGVar->isConstant(), GlobalValue::ExternalLinkage, /*init*/ nullptr, SGVar->getName(), /*insertbefore*/ nullptr, SGVar->getThreadLocalMode(), @@ -759,7 +759,7 @@ GlobalValue *IRLinker::copyGlobalValueProto(const GlobalValue *SGV, NewGV = copyGlobalAliasProto(cast<GlobalAlias>(SGV)); else NewGV = new GlobalVariable( - DstM, TypeMap.get(SGV->getType()->getElementType()), + DstM, TypeMap.get(SGV->getValueType()), /*isConstant*/ false, GlobalValue::ExternalLinkage, /*init*/ nullptr, SGV->getName(), /*insertbefore*/ nullptr, SGV->getThreadLocalMode(), @@ -802,8 +802,8 @@ void IRLinker::computeTypeMapping() { } // Unify the element type of appending arrays. - ArrayType *DAT = cast<ArrayType>(DGV->getType()->getElementType()); - ArrayType *SAT = cast<ArrayType>(SGV.getType()->getElementType()); + ArrayType *DAT = cast<ArrayType>(DGV->getValueType()); + ArrayType *SAT = cast<ArrayType>(SGV.getValueType()); TypeMap.addTypeMapping(DAT->getElementType(), SAT->getElementType()); } @@ -874,7 +874,7 @@ static void getArrayElements(const Constant *C, /// Return true on error. Constant *IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, const GlobalVariable *SrcGV) { - Type *EltTy = cast<ArrayType>(TypeMap.get(SrcGV->getType()->getElementType())) + Type *EltTy = cast<ArrayType>(TypeMap.get(SrcGV->getValueType())) ->getElementType(); StringRef Name = SrcGV->getName(); @@ -895,7 +895,7 @@ Constant *IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, } if (DstGV) { - ArrayType *DstTy = cast<ArrayType>(DstGV->getType()->getElementType()); + ArrayType *DstTy = cast<ArrayType>(DstGV->getValueType()); if (!SrcGV->hasAppendingLinkage() || !DstGV->hasAppendingLinkage()) { emitError( diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 6ffa71e1477..a418f640c02 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -471,10 +471,8 @@ bool ModuleLinker::computeResultingSelectionKind(StringRef ComdatName, const DataLayout &DstDL = DstM.getDataLayout(); const DataLayout &SrcDL = SrcM.getDataLayout(); - uint64_t DstSize = - DstDL.getTypeAllocSize(DstGV->getType()->getPointerElementType()); - uint64_t SrcSize = - SrcDL.getTypeAllocSize(SrcGV->getType()->getPointerElementType()); + uint64_t DstSize = DstDL.getTypeAllocSize(DstGV->getValueType()); + uint64_t SrcSize = SrcDL.getTypeAllocSize(SrcGV->getValueType()); if (Result == Comdat::SelectionKind::ExactMatch) { if (SrcGV->getInitializer() != DstGV->getInitializer()) return emitError("Linking COMDATs named '" + ComdatName + @@ -598,8 +596,8 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc, } const DataLayout &DL = Dest.getParent()->getDataLayout(); - uint64_t DestSize = DL.getTypeAllocSize(Dest.getType()->getElementType()); - uint64_t SrcSize = DL.getTypeAllocSize(Src.getType()->getElementType()); + uint64_t DestSize = DL.getTypeAllocSize(Dest.getValueType()); + uint64_t SrcSize = DL.getTypeAllocSize(Src.getValueType()); LinkFromSrc = SrcSize > DestSize; return false; } |