mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[NFC][OpaquePtr] Use GlobalValue::getValueType() more
Instead of getType()->getElementType().
This commit is contained in:
parent
2013929e05
commit
e29819ce26
@ -506,7 +506,7 @@ std::string Module::getUniqueIntrinsicName(StringRef BaseName, Intrinsic::ID Id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A declaration with this name already exists. Remember it.
|
// 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});
|
auto UinItInserted = UniquedIntrinsicNames.insert({{Id, FT}, Count});
|
||||||
if (FT == Proto) {
|
if (FT == Proto) {
|
||||||
// It was a declaration for our prototype. This entry was allocated in the
|
// It was a declaration for our prototype. This entry was allocated in the
|
||||||
|
@ -438,13 +438,12 @@ void ModuleLinker::dropReplacedComdat(
|
|||||||
} else {
|
} else {
|
||||||
auto &Alias = cast<GlobalAlias>(GV);
|
auto &Alias = cast<GlobalAlias>(GV);
|
||||||
Module &M = *Alias.getParent();
|
Module &M = *Alias.getParent();
|
||||||
PointerType &Ty = *cast<PointerType>(Alias.getType());
|
|
||||||
GlobalValue *Declaration;
|
GlobalValue *Declaration;
|
||||||
if (auto *FTy = dyn_cast<FunctionType>(Alias.getValueType())) {
|
if (auto *FTy = dyn_cast<FunctionType>(Alias.getValueType())) {
|
||||||
Declaration = Function::Create(FTy, GlobalValue::ExternalLinkage, "", &M);
|
Declaration = Function::Create(FTy, GlobalValue::ExternalLinkage, "", &M);
|
||||||
} else {
|
} else {
|
||||||
Declaration =
|
Declaration =
|
||||||
new GlobalVariable(M, Ty.getElementType(), /*isConstant*/ false,
|
new GlobalVariable(M, Alias.getValueType(), /*isConstant*/ false,
|
||||||
GlobalValue::ExternalLinkage,
|
GlobalValue::ExternalLinkage,
|
||||||
/*Initializer*/ nullptr);
|
/*Initializer*/ nullptr);
|
||||||
}
|
}
|
||||||
|
@ -277,8 +277,8 @@ Error Builder::addSymbol(const ModuleSymbolTable &Msymtab,
|
|||||||
if (!GVar)
|
if (!GVar)
|
||||||
return make_error<StringError>("Only variables can have common linkage!",
|
return make_error<StringError>("Only variables can have common linkage!",
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
Uncommon().CommonSize = GV->getParent()->getDataLayout().getTypeAllocSize(
|
Uncommon().CommonSize =
|
||||||
GV->getType()->getElementType());
|
GV->getParent()->getDataLayout().getTypeAllocSize(GV->getValueType());
|
||||||
Uncommon().CommonAlign = GVar->getAlignment();
|
Uncommon().CommonAlign = GVar->getAlignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1186,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
|
|||||||
DIExpression *E = GVe->getExpression();
|
DIExpression *E = GVe->getExpression();
|
||||||
const DataLayout &DL = GV->getParent()->getDataLayout();
|
const DataLayout &DL = GV->getParent()->getDataLayout();
|
||||||
unsigned SizeInOctets =
|
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
|
// It is expected that the address of global optimized variable is on
|
||||||
// top of the stack. After optimization, value of that variable will
|
// top of the stack. After optimization, value of that variable will
|
||||||
|
@ -306,7 +306,7 @@ static Optional<StringRef> nameOrNone(const Value *V) {
|
|||||||
void MemoryOpRemark::visitVariable(const Value *V,
|
void MemoryOpRemark::visitVariable(const Value *V,
|
||||||
SmallVectorImpl<VariableInfo> &Result) {
|
SmallVectorImpl<VariableInfo> &Result) {
|
||||||
if (auto *GV = dyn_cast<GlobalVariable>(V)) {
|
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();
|
uint64_t Size = DL.getTypeSizeInBits(Ty).getFixedSize();
|
||||||
VariableInfo Var{nameOrNone(GV), Size};
|
VariableInfo Var{nameOrNone(GV), Size};
|
||||||
if (!Var.isEmpty())
|
if (!Var.isEmpty())
|
||||||
|
@ -1032,8 +1032,8 @@ void Mapper::mapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix,
|
|||||||
Elements.push_back(NewV);
|
Elements.push_back(NewV);
|
||||||
}
|
}
|
||||||
|
|
||||||
GV.setInitializer(ConstantArray::get(
|
GV.setInitializer(
|
||||||
cast<ArrayType>(GV.getType()->getElementType()), Elements));
|
ConstantArray::get(cast<ArrayType>(GV.getValueType()), Elements));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper::scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init,
|
void Mapper::scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init,
|
||||||
|
@ -28,8 +28,7 @@ static int getUsedListSize(Module &M, StringRef Name) {
|
|||||||
auto *UsedList = M.getGlobalVariable(Name);
|
auto *UsedList = M.getGlobalVariable(Name);
|
||||||
if (!UsedList)
|
if (!UsedList)
|
||||||
return 0;
|
return 0;
|
||||||
auto *UsedListBaseArrayType =
|
auto *UsedListBaseArrayType = cast<ArrayType>(UsedList->getValueType());
|
||||||
cast<ArrayType>(UsedList->getType()->getElementType());
|
|
||||||
return UsedListBaseArrayType->getNumElements();
|
return UsedListBaseArrayType->getNumElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user