[llvm] 693bc04 - [OpaquePtr] Use GlobalValue::getValueType() more
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 13 09:34:45 PDT 2021
Author: Arthur Eubanks
Date: 2021-07-13T09:34:34-07:00
New Revision: 693bc04bf615b63b0070c7d1ad15257a7ce31a20
URL: https://github.com/llvm/llvm-project/commit/693bc04bf615b63b0070c7d1ad15257a7ce31a20
DIFF: https://github.com/llvm/llvm-project/commit/693bc04bf615b63b0070c7d1ad15257a7ce31a20.diff
LOG: [OpaquePtr] Use GlobalValue::getValueType() more
Added:
Modified:
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/lib/Transforms/Coroutines/Coroutines.cpp
llvm/lib/Transforms/IPO/MergeFunctions.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 76a1324bf34d7..5eac2cf52d388 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2356,7 +2356,7 @@ void PPCAIXAsmPrinter::emitGlobalVariableHelper(const GlobalVariable *GV) {
if (GV->hasCommonLinkage() || GVKind.isBSSLocal() ||
GVKind.isThreadBSSLocal()) {
Align Alignment = GV->getAlign().getValueOr(DL.getPreferredAlign(GV));
- uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType());
+ uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
GVSym->setStorageClass(
TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(GV));
diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 66b8e7ea6af91..66b97860f5a91 100644
--- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -504,11 +504,7 @@ static bool hasTocDataAttr(SDValue Val, unsigned PointerSize) {
"GlobalVariables with an alignment requirement stricter then 4-bytes "
"not supported by the toc data transformation.");
- Type *PtrType = GV->getType();
- assert(PtrType->isPointerTy() &&
- "GlobalVariables always have pointer type!.");
-
- Type *GVType = dyn_cast<PointerType>(PtrType)->getElementType();
+ Type *GVType = GV->getValueType();
assert(GVType->isSized() && "A GlobalVariable's size must be known to be "
"supported by the toc data transformation.");
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index e35875b476f54..fde758ca6db00 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -697,7 +697,7 @@ void CoroIdAsyncInst::checkWellFormed() const {
static void checkAsyncContextProjectFunction(const Instruction *I,
Function *F) {
- auto *FunTy = cast<FunctionType>(F->getType()->getPointerElementType());
+ auto *FunTy = cast<FunctionType>(F->getValueType());
if (!FunTy->getReturnType()->isPointerTy() ||
!FunTy->getReturnType()->getPointerElementType()->isIntegerTy(8))
fail(I,
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 8eac6c86b08d0..9e6dd879ac01d 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -767,9 +767,8 @@ static bool canCreateAliasFor(Function *F) {
void MergeFunctions::writeAlias(Function *F, Function *G) {
Constant *BitcastF = ConstantExpr::getBitCast(F, G->getType());
PointerType *PtrType = G->getType();
- auto *GA = GlobalAlias::create(
- PtrType->getElementType(), PtrType->getAddressSpace(),
- G->getLinkage(), "", BitcastF, G->getParent());
+ auto *GA = GlobalAlias::create(G->getValueType(), PtrType->getAddressSpace(),
+ G->getLinkage(), "", BitcastF, G->getParent());
F->setAlignment(MaybeAlign(std::max(F->getAlignment(), G->getAlignment())));
GA->takeName(G);
More information about the llvm-commits
mailing list