From 6a92ab07cbb6dda9d494d7909c2daee2d65d40b7 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Sun, 12 Sep 2021 21:33:55 -0700 Subject: [PATCH] [NFC][CoroSplit] Directly use Function::getFunctionType() --- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 3adcaf0..8992a18 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -773,9 +773,8 @@ Value *CoroCloner::deriveNewFramePointer() { auto DbgLoc = cast(VMap[ActiveSuspend])->getDebugLoc(); // Calling i8* (i8*) - auto *CallerContext = Builder.CreateCall( - cast(ProjectionFunc->getType()->getPointerElementType()), - ProjectionFunc, CalleeContext); + auto *CallerContext = Builder.CreateCall(ProjectionFunc->getFunctionType(), + ProjectionFunc, CalleeContext); CallerContext->setCallingConv(ProjectionFunc->getCallingConv()); CallerContext->setDebugLoc(DbgLoc); // The frame is located after the async_context header. @@ -1547,8 +1546,7 @@ static void coerceArguments(IRBuilder<> &Builder, FunctionType *FnTy, CallInst *coro::createMustTailCall(DebugLoc Loc, Function *MustTailCallFn, ArrayRef Arguments, IRBuilder<> &Builder) { - auto *FnTy = - cast(MustTailCallFn->getType()->getPointerElementType()); + auto *FnTy = MustTailCallFn->getFunctionType(); // Coerce the arguments, llvm optimizations seem to ignore the types in // vaarg functions and throws away casts in optimized mode. SmallVector CallArgs; -- 2.7.4