[llvm] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC)
authorNikita Popov <npopov@redhat.com>
Tue, 18 Jul 2023 09:39:02 +0000 (11:39 +0200)
committerNikita Popov <npopov@redhat.com>
Tue, 18 Jul 2023 09:41:46 +0000 (11:41 +0200)
llvm/lib/IR/Function.cpp
llvm/lib/Transforms/Coroutines/Coroutines.cpp
llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp

index 57163ad..27219e8 100644 (file)
@@ -1609,12 +1609,7 @@ static bool matchIntrinsicType(
       if (!ThisArgVecTy || !ReferenceType ||
           (ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
         return true;
-      PointerType *ThisArgEltTy =
-          dyn_cast<PointerType>(ThisArgVecTy->getElementType());
-      if (!ThisArgEltTy)
-        return true;
-      return !ThisArgEltTy->isOpaqueOrPointeeTypeMatches(
-          ReferenceType->getElementType());
+      return !ThisArgVecTy->getElementType()->isPointerTy();
     }
     case IITDescriptor::VecElementArgument: {
       if (D.getArgumentNumber() >= ArgTys.size())
index 399bff7..b101326 100644 (file)
@@ -612,18 +612,15 @@ static void checkAsyncContextProjectFunction(const Instruction *I,
                                              Function *F) {
   auto *FunTy = cast<FunctionType>(F->getValueType());
   Type *Int8Ty = Type::getInt8Ty(F->getContext());
-  auto *RetPtrTy = dyn_cast<PointerType>(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<PointerType>(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);
 }
 
index 2140544..9399230 100644 (file)
@@ -86,13 +86,7 @@ static bool callLooksLikeLoadStore(CallBase *CB, Value *&DataArg,
     if (!Arg->getType()->isSized())
       return false;
 
-    PointerType *PT = dyn_cast<PointerType>(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;
     }