if (!GV.hasDefinitiveInitializer())
return unknown();
- APInt Size(IntTyBits, DL.getTypeAllocSize(GV.getType()->getElementType()));
+ APInt Size(IntTyBits, DL.getTypeAllocSize(GV.getValueType()));
return std::make_pair(align(Size, GV.getAlignment()), Zero);
}
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
const DataLayout &DL = GV->getParent()->getDataLayout();
- uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType());
+ uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
// If the alignment is specified, we *must* obey it. Overaligning a global
// with a specified alignment is a prompt way to break globals emitted to
else
assert(GIS.hasLocalLinkage() && "Invalid alias or ifunc linkage");
- bool IsFunction = GIS.getType()->getPointerElementType()->isFunctionTy();
+ bool IsFunction = GIS.getValueType()->isFunctionTy();
// Treat bitcasts of functions as functions also. This is important at least
// on WebAssembly where object and function addresses can't alias each other.
return false;
}
- Type *GType = GVar->getType();
- if (PointerType *PT = dyn_cast<PointerType>(GType))
- GType = PT->getElementType();
-
+ Type *GType = GVar->getValueType();
if (isa<ArrayType>(GType)) {
LLVM_DEBUG(dbgs() << "no, is an array\n");
return false;
MCSection *HexagonTargetObjectFile::selectSmallSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
- const Type *GTy = GO->getType()->getElementType();
+ const Type *GTy = GO->getValueType();
unsigned Size = getSmallestAddressableSize(GTy, GO, TM);
// If we have -ffunction-section or -fdata-section then we should emit the