[llvm] r257999 - GlobalValue: use getValueType() instead of getType()->getPointerElementType().
Manuel Jacob via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 16 12:30:48 PST 2016
Author: mjacob
Date: Sat Jan 16 14:30:46 2016
New Revision: 257999
URL: http://llvm.org/viewvc/llvm-project?rev=257999&view=rev
Log:
GlobalValue: use getValueType() instead of getType()->getPointerElementType().
Reviewers: mjacob
Subscribers: jholewinski, arsenm, dsanders, dblaikie
Patch by Eduard Burtescu.
Differential Revision: http://reviews.llvm.org/D16260
Modified:
llvm/trunk/lib/Analysis/GlobalsModRef.cpp
llvm/trunk/lib/Analysis/Lint.cpp
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/lib/IR/DataLayout.cpp
llvm/trunk/lib/IR/Globals.cpp
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/lib/Linker/IRMover.cpp
llvm/trunk/lib/Linker/LinkModules.cpp
llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp
llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp
llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/lib/Analysis/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/GlobalsModRef.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/GlobalsModRef.cpp Sat Jan 16 14:30:46 2016
@@ -310,7 +310,7 @@ void GlobalsAAResult::AnalyzeGlobals(Mod
++NumNonAddrTakenGlobalVars;
// If this global holds a pointer type, see if it is an indirect global.
- if (GV.getType()->getElementType()->isPointerTy() &&
+ if (GV.getValueType()->isPointerTy() &&
AnalyzeIndirectGlobalMemory(&GV))
++NumIndirectGlobalVars;
}
Modified: llvm/trunk/lib/Analysis/Lint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Lint.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Lint.cpp (original)
+++ llvm/trunk/lib/Analysis/Lint.cpp Sat Jan 16 14:30:46 2016
@@ -435,7 +435,7 @@ void Lint::visitMemoryReference(Instruct
// If the global may be defined differently in another compilation unit
// then don't warn about funky memory accesses.
if (GV->hasDefinitiveInitializer()) {
- Type *GTy = GV->getType()->getElementType();
+ Type *GTy = GV->getValueType();
if (GTy->isSized())
BaseSize = DL->getTypeAllocSize(GTy);
BaseAlign = GV->getAlignment();
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sat Jan 16 14:30:46 2016
@@ -1560,7 +1560,7 @@ static unsigned getAlignment(const Value
Align = GO->getAlignment();
if (Align == 0) {
if (auto *GVar = dyn_cast<GlobalVariable>(GO)) {
- Type *ObjectType = GVar->getType()->getElementType();
+ Type *ObjectType = GVar->getValueType();
if (ObjectType->isSized()) {
// If the object is defined in the current Module, we'll be giving
// it the preferred alignment. Otherwise, we have to assume that it
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Sat Jan 16 14:30:46 2016
@@ -83,8 +83,8 @@ static const ConstantExpr *getMergedGlob
// First operand points to a global struct.
Value *Ptr = CE->getOperand(0);
- if (!isa<GlobalValue>(Ptr) ||
- !isa<StructType>(cast<PointerType>(Ptr->getType())->getElementType()))
+ GlobalValue *GV = dyn_cast<GlobalValue>(Ptr);
+ if (!GV || !isa<StructType>(GV->getValueType()))
return nullptr;
// Second operand is zero.
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Sat Jan 16 14:30:46 2016
@@ -1744,7 +1744,7 @@ bool CodeGenPrepare::optimizeCallInst(Ca
GlobalVariable *GV;
if ((GV = dyn_cast<GlobalVariable>(Val)) && GV->canIncreaseAlignment() &&
GV->getAlignment() < PrefAlign &&
- DL->getTypeAllocSize(GV->getType()->getElementType()) >=
+ DL->getTypeAllocSize(GV->getValueType()) >=
MinSize + Offset2)
GV->setAlignment(PrefAlign);
}
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sat Jan 16 14:30:46 2016
@@ -103,7 +103,7 @@ public:
/// \brief Returns the address the GlobalVariable should be written into. The
/// GVMemoryBlock object prefixes that.
static char *Create(const GlobalVariable *GV, const DataLayout& TD) {
- Type *ElTy = GV->getType()->getElementType();
+ Type *ElTy = GV->getValueType();
size_t GVSize = (size_t)TD.getTypeAllocSize(ElTy);
void *RawMemory = ::operator new(
alignTo(sizeof(GVMemoryBlock), TD.getPreferredAlignment(GV)) + GVSize);
@@ -1353,7 +1353,7 @@ void ExecutionEngine::EmitGlobalVariable
if (!GV->isThreadLocal())
InitializeMemory(GV->getInitializer(), GA);
- Type *ElTy = GV->getType()->getElementType();
+ Type *ElTy = GV->getValueType();
size_t GVSize = (size_t)getDataLayout().getTypeAllocSize(ElTy);
NumInitBytes += (unsigned)GVSize;
++NumGlobals;
Modified: llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp Sat Jan 16 14:30:46 2016
@@ -116,7 +116,7 @@ Function* cloneFunctionDecl(Module &Dst,
ValueToValueMapTy *VMap) {
assert(F.getParent() != &Dst && "Can't copy decl over existing function.");
Function *NewF =
- Function::Create(cast<FunctionType>(F.getType()->getElementType()),
+ Function::Create(cast<FunctionType>(F.getValueType()),
F.getLinkage(), F.getName(), &Dst);
NewF->copyAttributesFrom(&F);
@@ -154,7 +154,7 @@ GlobalVariable* cloneGlobalVariableDecl(
ValueToValueMapTy *VMap) {
assert(GV.getParent() != &Dst && "Can't copy decl over existing global var.");
GlobalVariable *NewGV = new GlobalVariable(
- Dst, GV.getType()->getElementType(), GV.isConstant(),
+ Dst, GV.getValueType(), GV.isConstant(),
GV.getLinkage(), nullptr, GV.getName(), nullptr,
GV.getThreadLocalMode(), GV.getType()->getAddressSpace());
NewGV->copyAttributesFrom(&GV);
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Sat Jan 16 14:30:46 2016
@@ -2416,7 +2416,7 @@ void AssemblyWriter::printGlobal(const G
Out << "addrspace(" << AddressSpace << ") ";
if (GV->isExternallyInitialized()) Out << "externally_initialized ";
Out << (GV->isConstant() ? "constant " : "global ");
- TypePrinter.print(GV->getType()->getElementType(), Out);
+ TypePrinter.print(GV->getValueType(), Out);
if (GV->hasInitializer()) {
Out << ' ';
Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Sat Jan 16 14:30:46 2016
@@ -764,7 +764,7 @@ uint64_t DataLayout::getIndexedOffset(Ty
/// global. This includes an explicitly requested alignment (if the global
/// has one).
unsigned DataLayout::getPreferredAlignment(const GlobalVariable *GV) const {
- Type *ElemType = GV->getType()->getElementType();
+ Type *ElemType = GV->getValueType();
unsigned Alignment = getPrefTypeAlignment(ElemType);
unsigned GVAlignment = GV->getAlignment();
if (GVAlignment >= Alignment) {
Modified: llvm/trunk/lib/IR/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Globals.cpp (original)
+++ llvm/trunk/lib/IR/Globals.cpp Sat Jan 16 14:30:46 2016
@@ -242,7 +242,7 @@ void GlobalVariable::setInitializer(Cons
setGlobalVariableNumOperands(0);
}
} else {
- assert(InitVal->getType() == getType()->getElementType() &&
+ assert(InitVal->getType() == getValueType() &&
"Initializer type must match GlobalVariable type");
// Note, the num operands is used to compute the offset of the operand, so
// the order here matters. We need to set num operands to 1 first so that
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Sat Jan 16 14:30:46 2016
@@ -521,7 +521,7 @@ void Verifier::visitGlobalValue(const Gl
void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
if (GV.hasInitializer()) {
- Assert(GV.getInitializer()->getType() == GV.getType()->getElementType(),
+ Assert(GV.getInitializer()->getType() == GV.getValueType(),
"Global variable initializer type does not match global "
"variable type!",
&GV);
Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Sat Jan 16 14:30:46 2016
@@ -719,7 +719,7 @@ GlobalVariable *IRLinker::copyGlobalVari
// 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::copyGlobalValuePr
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 Const
/// 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::linkAppendingVarProt
}
if (DstGV) {
- ArrayType *DstTy = cast<ArrayType>(DstGV->getType()->getElementType());
+ ArrayType *DstTy = cast<ArrayType>(DstGV->getValueType());
if (!SrcGV->hasAppendingLinkage() || !DstGV->hasAppendingLinkage()) {
emitError(
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Jan 16 14:30:46 2016
@@ -471,10 +471,8 @@ bool ModuleLinker::computeResultingSelec
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(
}
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;
}
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp Sat Jan 16 14:30:46 2016
@@ -687,7 +687,7 @@ bool AArch64DAGToDAGISel::SelectAddrMode
const GlobalValue *GV = GAN->getGlobal();
unsigned Alignment = GV->getAlignment();
- Type *Ty = GV->getType()->getElementType();
+ Type *Ty = GV->getValueType();
if (Alignment == 0 && Ty->isSized())
Alignment = DL.getABITypeAlignment(Ty);
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Sat Jan 16 14:30:46 2016
@@ -808,7 +808,7 @@ SDValue AMDGPUTargetLowering::LowerGloba
unsigned Offset;
if (MFI->LocalMemoryObjects.count(GV) == 0) {
- uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType());
+ uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
Offset = MFI->LDSSize;
MFI->LocalMemoryObjects[GV] = Offset;
// XXX: Account for alignment?
@@ -822,7 +822,7 @@ SDValue AMDGPUTargetLowering::LowerGloba
}
case AMDGPUAS::CONSTANT_ADDRESS: {
MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo();
- Type *EltType = GV->getType()->getElementType();
+ Type *EltType = GV->getValueType();
unsigned Size = DL.getTypeAllocSize(EltType);
unsigned Alignment = DL.getPrefTypeAlignment(EltType);
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp Sat Jan 16 14:30:46 2016
@@ -78,8 +78,7 @@ bool AMDGPUPromoteAlloca::runOnFunction(
for (Module::global_iterator I = Mod->global_begin(),
E = Mod->global_end(); I != E; ++I) {
GlobalVariable *GV = &*I;
- PointerType *GVTy = GV->getType();
- if (GVTy->getAddressSpace() != AMDGPUAS::LOCAL_ADDRESS)
+ if (GV->getType()->getAddressSpace() != AMDGPUAS::LOCAL_ADDRESS)
continue;
for (Value::use_iterator U = GV->use_begin(),
UE = GV->use_end(); U != UE; ++U) {
@@ -88,7 +87,7 @@ bool AMDGPUPromoteAlloca::runOnFunction(
continue;
if (Use->getParent()->getParent() == &F)
LocalMemAvailable -=
- Mod->getDataLayout().getTypeAllocSize(GVTy->getElementType());
+ Mod->getDataLayout().getTypeAllocSize(GV->getValueType());
}
}
}
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Sat Jan 16 14:30:46 2016
@@ -437,7 +437,7 @@ std::string CppWriter::getCppName(const
if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(val)) {
name = std::string("gvar_") +
- getTypePrefix(GV->getType()->getElementType());
+ getTypePrefix(GV->getValueType());
} else if (isa<Function>(val)) {
name = std::string("func_");
} else if (const Constant* C = dyn_cast<Constant>(val)) {
@@ -997,13 +997,13 @@ void CppWriter::printVariableHead(const
if (is_inline) {
Out << " = mod->getGlobalVariable(mod->getContext(), ";
printEscapedString(GV->getName());
- Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
+ Out << ", " << getCppName(GV->getValueType()) << ",true)";
nl(Out) << "if (!" << getCppName(GV) << ") {";
in(); nl(Out) << getCppName(GV);
}
Out << " = new GlobalVariable(/*Module=*/*mod, ";
nl(Out) << "/*Type=*/";
- printCppName(GV->getType()->getElementType());
+ printCppName(GV->getValueType());
Out << ",";
nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
Out << ",";
Modified: llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp Sat Jan 16 14:30:46 2016
@@ -74,7 +74,7 @@ IsGlobalInSmallSection(const GlobalValue
return false;
if (Kind.isBSS() || Kind.isData() || Kind.isCommon()) {
- Type *Ty = GV->getType()->getElementType();
+ Type *Ty = GV->getValueType();
return IsInSmallSection(
GV->getParent()->getDataLayout().getTypeAllocSize(Ty));
}
Modified: llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp Sat Jan 16 14:30:46 2016
@@ -106,7 +106,7 @@ IsGlobalInSmallSectionImpl(const GlobalV
GV->hasCommonLinkage()))
return false;
- Type *Ty = GV->getType()->getElementType();
+ Type *Ty = GV->getValueType();
return IsInSmallSection(
GV->getParent()->getDataLayout().getTypeAllocSize(Ty));
}
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Sat Jan 16 14:30:46 2016
@@ -1030,7 +1030,7 @@ void NVPTXAsmPrinter::printModuleLevelGV
// GlobalVariables are always constant pointers themselves.
PointerType *PTy = GVar->getType();
- Type *ETy = PTy->getElementType();
+ Type *ETy = GVar->getValueType();
if (GVar->hasExternalLinkage()) {
if (GVar->hasInitializer())
@@ -1341,11 +1341,10 @@ void NVPTXAsmPrinter::emitPTXGlobalVaria
const DataLayout &DL = getDataLayout();
// GlobalVariables are always constant pointers themselves.
- PointerType *PTy = GVar->getType();
- Type *ETy = PTy->getElementType();
+ Type *ETy = GVar->getValueType();
O << ".";
- emitPTXAddressSpace(PTy->getAddressSpace(), O);
+ emitPTXAddressSpace(GVar->getType()->getAddressSpace(), O);
if (GVar->getAlignment() == 0)
O << " .align " << (int)DL.getPrefTypeAlignment(ETy);
else
@@ -1715,9 +1714,8 @@ void NVPTXAsmPrinter::printScalarConstan
return;
}
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
- PointerType *PTy = dyn_cast<PointerType>(GVar->getType());
bool IsNonGenericPointer = false;
- if (PTy && PTy->getAddressSpace() != 0) {
+ if (GVar->getType()->getAddressSpace() != 0) {
IsNonGenericPointer = true;
}
if (EmitGeneric && !isa<Function>(CPV) && !IsNonGenericPointer) {
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp Sat Jan 16 14:30:46 2016
@@ -86,7 +86,7 @@ bool GenericToNVVM::runOnModule(Module &
!llvm::isTexture(*GV) && !llvm::isSurface(*GV) &&
!llvm::isSampler(*GV) && !GV->getName().startswith("llvm.")) {
GlobalVariable *NewGV = new GlobalVariable(
- M, GV->getType()->getElementType(), GV->isConstant(),
+ M, GV->getValueType(), GV->isConstant(),
GV->getLinkage(),
GV->hasInitializer() ? GV->getInitializer() : nullptr,
"", GV, GV->getThreadLocalMode(), llvm::ADDRESS_SPACE_GLOBAL);
@@ -172,7 +172,7 @@ Value *GenericToNVVM::getOrInsertCVTA(Mo
// See if the address space conversion requires the operand to be bitcast
// to i8 addrspace(n)* first.
- EVT ExtendedGVType = EVT::getEVT(GVType->getElementType(), true);
+ EVT ExtendedGVType = EVT::getEVT(GV->getValueType(), true);
if (!ExtendedGVType.isInteger() && !ExtendedGVType.isFloatingPoint()) {
// A bitcast to i8 addrspace(n)* on the operand is needed.
LLVMContext &Context = M->getContext();
@@ -191,12 +191,12 @@ Value *GenericToNVVM::getOrInsertCVTA(Mo
// Another bitcast from i8 * to <the element type of GVType> * is
// required.
DestTy =
- PointerType::get(GVType->getElementType(), llvm::ADDRESS_SPACE_GENERIC);
+ PointerType::get(GV->getValueType(), llvm::ADDRESS_SPACE_GENERIC);
CVTA = Builder.CreateBitCast(CVTA, DestTy, "cvta");
} else {
// A simple CVTA is enough.
SmallVector<Type *, 2> ParamTypes;
- ParamTypes.push_back(PointerType::get(GVType->getElementType(),
+ ParamTypes.push_back(PointerType::get(GV->getValueType(),
llvm::ADDRESS_SPACE_GENERIC));
ParamTypes.push_back(GVType);
Function *CVTAFunction = Intrinsic::getDeclaration(
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Sat Jan 16 14:30:46 2016
@@ -4091,7 +4091,7 @@ static bool isFunctionGlobalAddress(SDVa
Callee.getOpcode() == ISD::TargetGlobalTLSAddress)
return false;
- return G->getGlobal()->getType()->getElementType()->isFunctionTy();
+ return G->getGlobal()->getValueType()->isFunctionTy();
}
return false;
Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Sat Jan 16 14:30:46 2016
@@ -93,8 +93,7 @@ void XCoreAsmPrinter::emitArrayBound(MCS
assert( ( GV->hasExternalLinkage() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() ) &&
"Unexpected linkage");
- if (ArrayType *ATy = dyn_cast<ArrayType>(
- cast<PointerType>(GV->getType())->getElementType())) {
+ if (ArrayType *ATy = dyn_cast<ArrayType>(GV->getValueType())) {
MCSymbol *SymGlob = OutContext.getOrCreateSymbol(
Twine(Sym->getName() + StringRef(".globound")));
Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Sat Jan 16 14:30:46 2016
@@ -257,7 +257,7 @@ SDValue XCoreTargetLowering::getGlobalAd
// FIXME there is no actual debug info here
SDLoc dl(GA);
- if (GV->getType()->getElementType()->isFunctionTy())
+ if (GV->getValueType()->isFunctionTy())
return DAG.getNode(XCoreISD::PCRelativeWrapper, dl, MVT::i32, GA);
const auto *GVar = dyn_cast<GlobalVariable>(GV);
@@ -272,7 +272,7 @@ static bool IsSmallObject(const GlobalVa
if (XTL.getTargetMachine().getCodeModel() == CodeModel::Small)
return true;
- Type *ObjType = GV->getType()->getPointerElementType();
+ Type *ObjType = GV->getValueType();
if (!ObjType->isSized())
return false;
Modified: llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp Sat Jan 16 14:30:46 2016
@@ -189,7 +189,7 @@ bool XCoreLowerThreadLocal::lowerGlobal(
return false;
// Create replacement global.
- ArrayType *NewType = createLoweredType(GV->getType()->getElementType());
+ ArrayType *NewType = createLoweredType(GV->getValueType());
Constant *NewInitializer = nullptr;
if (GV->hasInitializer())
NewInitializer = createLoweredInitializer(NewType,
Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Sat Jan 16 14:30:46 2016
@@ -122,7 +122,7 @@ XCoreTargetObjectFile::SelectSectionForG
if (Kind.isMergeableConst8()) return MergeableConst8Section;
if (Kind.isMergeableConst16()) return MergeableConst16Section;
}
- Type *ObjType = GV->getType()->getPointerElementType();
+ Type *ObjType = GV->getValueType();
auto &DL = GV->getParent()->getDataLayout();
if (TM.getCodeModel() == CodeModel::Small || !ObjType->isSized() ||
DL.getTypeAllocSize(ObjType) < CodeModelLargeSize) {
Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Sat Jan 16 14:30:46 2016
@@ -128,7 +128,7 @@ namespace {
makeVisible(*CurI, Delete);
if (Delete) {
- Type *Ty = CurI->getType()->getElementType();
+ Type *Ty = CurI->getValueType();
CurI->removeFromParent();
llvm::Value *Declaration;
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sat Jan 16 14:30:46 2016
@@ -120,7 +120,7 @@ static bool isLeakCheckerRoot(GlobalVari
return false;
SmallVector<Type *, 4> Types;
- Types.push_back(cast<PointerType>(GV->getType())->getElementType());
+ Types.push_back(GV->getValueType());
unsigned Limit = 20;
do {
@@ -867,9 +867,8 @@ OptimizeGlobalAddressOfMalloc(GlobalVari
}
Constant *RepValue = NewGV;
- if (NewGV->getType() != GV->getType()->getElementType())
- RepValue = ConstantExpr::getBitCast(RepValue,
- GV->getType()->getElementType());
+ if (NewGV->getType() != GV->getValueType())
+ RepValue = ConstantExpr::getBitCast(RepValue, GV->getValueType());
// If there is a comparison against null, we will insert a global bool to
// keep track of whether the global was initialized yet or not.
@@ -1397,8 +1396,8 @@ static GlobalVariable *PerformHeapAllocS
// Insert a store of null into each global.
for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) {
- PointerType *PT = cast<PointerType>(FieldGlobals[i]->getType());
- Constant *Null = Constant::getNullValue(PT->getElementType());
+ Type *ValTy = cast<GlobalValue>(FieldGlobals[i])->getValueType();
+ Constant *Null = Constant::getNullValue(ValTy);
new StoreInst(Null, FieldGlobals[i], SI);
}
// Erase the original store.
@@ -1583,7 +1582,7 @@ static bool optimizeOnceStoredGlobal(Glo
/// boolean and select between the two values whenever it is used. This exposes
/// the values to other scalar optimizations.
static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
- Type *GVElType = GV->getType()->getElementType();
+ Type *GVElType = GV->getValueType();
// If GVElType is already i1, it is already shrunk. If the type of the GV is
// an FP value, pointer or vector, don't do this optimization because a select
@@ -1879,7 +1878,7 @@ bool GlobalOpt::processInternalGlobal(Gl
// If the global is in different address space, don't bring it to stack.
if (!GS.HasMultipleAccessingFunctions &&
GS.AccessingFunction &&
- GV->getType()->getElementType()->isSingleValueType() &&
+ GV->getValueType()->isSingleValueType() &&
GV->getType()->getAddressSpace() == 0 &&
!GV->isExternallyInitialized() &&
allNonInstructionUsersCanBeMadeInstructions(GV) &&
@@ -1888,7 +1887,7 @@ bool GlobalOpt::processInternalGlobal(Gl
DEBUG(dbgs() << "LOCALIZING GLOBAL: " << *GV << "\n");
Instruction &FirstI = const_cast<Instruction&>(*GS.AccessingFunction
->getEntryBlock().begin());
- Type *ElemTy = GV->getType()->getElementType();
+ Type *ElemTy = GV->getValueType();
// FIXME: Pass Global's alignment when globals have alignment
AllocaInst *Alloca = new AllocaInst(ElemTy, nullptr,
GV->getName(), &FirstI);
@@ -2627,7 +2626,7 @@ bool Evaluator::EvaluateBlock(BasicBlock
Value *PtrArg = getVal(II->getArgOperand(1));
Value *Ptr = PtrArg->stripPointerCasts();
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr)) {
- Type *ElemTy = cast<PointerType>(GV->getType())->getElementType();
+ Type *ElemTy = GV->getValueType();
if (!Size->isAllOnesValue() &&
Size->getValue().getLimitedValue() >=
DL.getTypeStoreSize(ElemTy)) {
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Sat Jan 16 14:30:46 2016
@@ -2351,8 +2351,7 @@ InstCombiner::transformCallThroughTrampo
"transformCallThroughTrampoline called with incorrect CallSite.");
Function *NestF =cast<Function>(Tramp->getArgOperand(1)->stripPointerCasts());
- PointerType *NestFPTy = cast<PointerType>(NestF->getType());
- FunctionType *NestFTy = cast<FunctionType>(NestFPTy->getElementType());
+ FunctionType *NestFTy = cast<FunctionType>(NestF->getValueType());
const AttributeSet &NestAttrs = NestF->getAttributes();
if (!NestAttrs.isEmpty()) {
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Sat Jan 16 14:30:46 2016
@@ -637,7 +637,7 @@ static bool isObjectSizeLessThanOrEq(Val
if (!GV->hasDefinitiveInitializer() || !GV->isConstant())
return false;
- uint64_t InitSize = DL.getTypeAllocSize(GV->getType()->getElementType());
+ uint64_t InitSize = DL.getTypeAllocSize(GV->getValueType());
if (InitSize > MaxSize)
return false;
continue;
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Sat Jan 16 14:30:46 2016
@@ -1184,7 +1184,7 @@ void AddressSanitizerModule::createIniti
}
bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
- Type *Ty = cast<PointerType>(G->getType())->getElementType();
+ Type *Ty = G->getValueType();
DEBUG(dbgs() << "GLOBAL: " << *G << "\n");
if (GlobalsMD.get(G).IsBlacklisted) return false;
@@ -1338,8 +1338,7 @@ bool AddressSanitizerModule::InstrumentG
M, MD.Name.empty() ? G->getName() : MD.Name,
/*AllowMerging*/ true);
- PointerType *PtrTy = cast<PointerType>(G->getType());
- Type *Ty = PtrTy->getElementType();
+ Type *Ty = G->getValueType();
uint64_t SizeInBytes = DL.getTypeAllocSize(Ty);
uint64_t MinRZ = MinRedzoneSizeForGlobal();
// MinRZ <= RZ <= kMaxGlobalRedzone
Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sat Jan 16 14:30:46 2016
@@ -134,7 +134,7 @@ namespace {
StringRef GetGlobalTypeString(const GlobalValue &G) {
// Types of GlobalVariables are always pointer types.
- Type *GType = G.getType()->getElementType();
+ Type *GType = G.getValueType();
// For now we support blacklisting struct types only.
if (StructType *SGType = dyn_cast<StructType>(GType)) {
if (!SGType->isLiteral())
@@ -166,7 +166,7 @@ class DFSanABIList {
if (isIn(*GA.getParent(), Category))
return true;
- if (isa<FunctionType>(GA.getType()->getElementType()))
+ if (isa<FunctionType>(GA.getValueType()))
return SCL->inSection("fun", GA.getName(), Category);
return SCL->inSection("global", GA.getName(), Category) ||
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Sat Jan 16 14:30:46 2016
@@ -874,7 +874,7 @@ Function *GCOVProfiler::insertCounterWri
GlobalVariable *GV = CountersBySP[j].first;
unsigned Arcs =
- cast<ArrayType>(GV->getType()->getElementType())->getNumElements();
+ cast<ArrayType>(GV->getValueType())->getNumElements();
Builder.CreateCall(EmitArcs, {Builder.getInt32(Arcs),
Builder.CreateConstGEP2_64(GV, 0, 0)});
}
@@ -966,7 +966,7 @@ insertFlush(ArrayRef<std::pair<GlobalVar
I = CountersBySP.begin(), E = CountersBySP.end();
I != E; ++I) {
GlobalVariable *GV = I->first;
- Constant *Null = Constant::getNullValue(GV->getType()->getElementType());
+ Constant *Null = Constant::getNullValue(GV->getValueType());
Builder.CreateStore(Null, GV);
}
Modified: llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp Sat Jan 16 14:30:46 2016
@@ -763,7 +763,7 @@ InsertSafepointPoll(Instruction *InsertB
auto *F = M->getFunction(GCSafepointPollName);
assert(F && "gc.safepoint_poll function is missing");
- assert(F->getType()->getElementType() ==
+ assert(F->getValueType() ==
FunctionType::get(Type::getVoidTy(M->getContext()), false) &&
"gc.safepoint_poll declared with wrong type");
assert(!F->empty() && "gc.safepoint_poll must be a non-empty function");
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Sat Jan 16 14:30:46 2016
@@ -228,7 +228,7 @@ public:
/// performing Interprocedural SCCP.
void TrackValueOfGlobalVariable(GlobalVariable *GV) {
// We only track the contents of scalar globals.
- if (GV->getType()->getElementType()->isSingleValueType()) {
+ if (GV->getValueType()->isSingleValueType()) {
LatticeVal &IV = TrackedGlobals[GV];
if (!isa<UndefValue>(GV->getInitializer()))
IV.markConstant(GV->getInitializer());
Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Sat Jan 16 14:30:46 2016
@@ -53,7 +53,7 @@ std::unique_ptr<Module> llvm::CloneModul
for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
GlobalVariable *GV = new GlobalVariable(*New,
- I->getType()->getElementType(),
+ I->getValueType(),
I->isConstant(), I->getLinkage(),
(Constant*) nullptr, I->getName(),
(GlobalVariable*) nullptr,
@@ -66,7 +66,7 @@ std::unique_ptr<Module> llvm::CloneModul
// Loop over the functions in the module, making external functions as before
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
Function *NF =
- Function::Create(cast<FunctionType>(I->getType()->getElementType()),
+ Function::Create(cast<FunctionType>(I->getValueType()),
I->getLinkage(), I->getName(), New.get());
NF->copyAttributesFrom(&*I);
VMap[&*I] = NF;
Modified: llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp Sat Jan 16 14:30:46 2016
@@ -33,7 +33,7 @@ static void appendToGlobalArray(const ch
if (GlobalVariable *GVCtor = M.getNamedGlobal(Array)) {
// If there is a global_ctors array, use the existing struct type, which can
// have 2 or 3 fields.
- ArrayType *ATy = cast<ArrayType>(GVCtor->getType()->getElementType());
+ ArrayType *ATy = cast<ArrayType>(GVCtor->getValueType());
EltTy = cast<StructType>(ATy->getElementType());
if (Constant *Init = GVCtor->getInitializer()) {
unsigned n = Init->getNumOperands();
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=257999&r1=257998&r2=257999&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Sat Jan 16 14:30:46 2016
@@ -792,7 +792,7 @@ static char getSymbolNMTypeChar(MachOObj
}
static char getSymbolNMTypeChar(const GlobalValue &GV) {
- if (GV.getType()->getElementType()->isFunctionTy())
+ if (GV.getValueType()->isFunctionTy())
return 't';
// FIXME: should we print 'b'? At the IR level we cannot be sure if this
// will be in bss or not, but we could approximate.
More information about the llvm-commits
mailing list