From: Tim Northover Date: Thu, 11 Jul 2019 13:13:02 +0000 (+0000) Subject: OpaquePtr: switch to GlobalValue::getValueType in a few places. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f75a0e800f673955f89ebd8dc3cfc0b6b8316a1d;p=llvm OpaquePtr: switch to GlobalValue::getValueType in a few places. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365770 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp index d73419fad6a..729dad46365 100644 --- a/lib/Analysis/MemoryBuiltins.cpp +++ b/lib/Analysis/MemoryBuiltins.cpp @@ -724,7 +724,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable(GlobalVariable &GV){ 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); } diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 9a2e0f58dad..174a9bcfd9b 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -495,7 +495,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { 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 @@ -1300,7 +1300,7 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M, 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. diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp index d797ce2f4ee..fdcc41a4ca4 100644 --- a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp +++ b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp @@ -238,10 +238,7 @@ bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO, return false; } - Type *GType = GVar->getType(); - if (PointerType *PT = dyn_cast(GType)) - GType = PT->getElementType(); - + Type *GType = GVar->getValueType(); if (isa(GType)) { LLVM_DEBUG(dbgs() << "no, is an array\n"); return false; @@ -341,7 +338,7 @@ unsigned HexagonTargetObjectFile::getSmallestAddressableSize(const Type *Ty, 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