Instead of getType()->getElementType().
}
// A declaration with this name already exists. Remember it.
- FunctionType *FT = dyn_cast<FunctionType>(F->getType()->getElementType());
+ FunctionType *FT = dyn_cast<FunctionType>(F->getValueType());
auto UinItInserted = UniquedIntrinsicNames.insert({{Id, FT}, Count});
if (FT == Proto) {
// It was a declaration for our prototype. This entry was allocated in the
} else {
auto &Alias = cast<GlobalAlias>(GV);
Module &M = *Alias.getParent();
- PointerType &Ty = *cast<PointerType>(Alias.getType());
GlobalValue *Declaration;
if (auto *FTy = dyn_cast<FunctionType>(Alias.getValueType())) {
Declaration = Function::Create(FTy, GlobalValue::ExternalLinkage, "", &M);
} else {
Declaration =
- new GlobalVariable(M, Ty.getElementType(), /*isConstant*/ false,
+ new GlobalVariable(M, Alias.getValueType(), /*isConstant*/ false,
GlobalValue::ExternalLinkage,
/*Initializer*/ nullptr);
}
if (!GVar)
return make_error<StringError>("Only variables can have common linkage!",
inconvertibleErrorCode());
- Uncommon().CommonSize = GV->getParent()->getDataLayout().getTypeAllocSize(
- GV->getType()->getElementType());
+ Uncommon().CommonSize =
+ GV->getParent()->getDataLayout().getTypeAllocSize(GV->getValueType());
Uncommon().CommonAlign = GVar->getAlignment();
}
DIExpression *E = GVe->getExpression();
const DataLayout &DL = GV->getParent()->getDataLayout();
unsigned SizeInOctets =
- DL.getTypeAllocSizeInBits(NewGV->getType()->getElementType()) / 8;
+ DL.getTypeAllocSizeInBits(NewGV->getValueType()) / 8;
// It is expected that the address of global optimized variable is on
// top of the stack. After optimization, value of that variable will
void MemoryOpRemark::visitVariable(const Value *V,
SmallVectorImpl<VariableInfo> &Result) {
if (auto *GV = dyn_cast<GlobalVariable>(V)) {
- auto *Ty = cast<PointerType>(GV->getType())->getElementType();
+ auto *Ty = GV->getValueType();
uint64_t Size = DL.getTypeSizeInBits(Ty).getFixedSize();
VariableInfo Var{nameOrNone(GV), Size};
if (!Var.isEmpty())
Elements.push_back(NewV);
}
- GV.setInitializer(ConstantArray::get(
- cast<ArrayType>(GV.getType()->getElementType()), Elements));
+ GV.setInitializer(
+ ConstantArray::get(cast<ArrayType>(GV.getValueType()), Elements));
}
void Mapper::scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init,
auto *UsedList = M.getGlobalVariable(Name);
if (!UsedList)
return 0;
- auto *UsedListBaseArrayType =
- cast<ArrayType>(UsedList->getType()->getElementType());
+ auto *UsedListBaseArrayType = cast<ArrayType>(UsedList->getValueType());
return UsedListBaseArrayType->getNumElements();
}