From 35bdcb03d91fb98f6d400505183613f6f8aa7af3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 18 Jul 2023 11:39:02 +0200 Subject: [PATCH] [llvm] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC) --- llvm/lib/IR/Function.cpp | 7 +------ llvm/lib/Transforms/Coroutines/Coroutines.cpp | 11 ++++------- llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp | 8 +------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 57163ad..27219e8 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1609,12 +1609,7 @@ static bool matchIntrinsicType( if (!ThisArgVecTy || !ReferenceType || (ReferenceType->getElementCount() != ThisArgVecTy->getElementCount())) return true; - PointerType *ThisArgEltTy = - dyn_cast(ThisArgVecTy->getElementType()); - if (!ThisArgEltTy) - return true; - return !ThisArgEltTy->isOpaqueOrPointeeTypeMatches( - ReferenceType->getElementType()); + return !ThisArgVecTy->getElementType()->isPointerTy(); } case IITDescriptor::VecElementArgument: { if (D.getArgumentNumber() >= ArgTys.size()) diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp index 399bff7..b101326 100644 --- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp +++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp @@ -612,18 +612,15 @@ static void checkAsyncContextProjectFunction(const Instruction *I, Function *F) { auto *FunTy = cast(F->getValueType()); Type *Int8Ty = Type::getInt8Ty(F->getContext()); - auto *RetPtrTy = dyn_cast(FunTy->getReturnType()); - if (!RetPtrTy || !RetPtrTy->isOpaqueOrPointeeTypeMatches(Int8Ty)) + if (!FunTy->getReturnType()->isPointerTy()) fail(I, "llvm.coro.suspend.async resume function projection function must " - "return an i8* type", + "return a ptr type", F); - if (FunTy->getNumParams() != 1 || !FunTy->getParamType(0)->isPointerTy() || - !cast(FunTy->getParamType(0)) - ->isOpaqueOrPointeeTypeMatches(Int8Ty)) + if (FunTy->getNumParams() != 1 || !FunTy->getParamType(0)->isPointerTy()) fail(I, "llvm.coro.suspend.async resume function projection function must " - "take one i8* type as parameter", + "take one ptr type as parameter", F); } diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp index 2140544..93992303 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp @@ -86,13 +86,7 @@ static bool callLooksLikeLoadStore(CallBase *CB, Value *&DataArg, if (!Arg->getType()->isSized()) return false; - PointerType *PT = dyn_cast(Arg->getType()); - if (!PtrArg && PT) { - // FIXME: Could create bitcast for typed pointers, but roll back unused - // replacement only erases one instruction. - if (!IsStore && !PT->isOpaqueOrPointeeTypeMatches(CB->getType())) - return false; - + if (!PtrArg && Arg->getType()->isPointerTy()) { PtrArg = Arg; continue; } -- 2.7.4