[llvm] 6a92ab0 - [NFC][CoroSplit] Directly use Function::getFunctionType()

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 12 21:37:09 PDT 2021


Author: Arthur Eubanks
Date: 2021-09-12T21:34:19-07:00
New Revision: 6a92ab07cbb6dda9d494d7909c2daee2d65d40b7

URL: https://github.com/llvm/llvm-project/commit/6a92ab07cbb6dda9d494d7909c2daee2d65d40b7
DIFF: https://github.com/llvm/llvm-project/commit/6a92ab07cbb6dda9d494d7909c2daee2d65d40b7.diff

LOG: [NFC][CoroSplit] Directly use Function::getFunctionType()

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 3adcaf011d389..8992a189b2abe 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<CoroSuspendAsyncInst>(VMap[ActiveSuspend])->getDebugLoc();
     // Calling i8* (i8*)
-    auto *CallerContext = Builder.CreateCall(
-        cast<FunctionType>(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<Value *> Arguments,
                                    IRBuilder<> &Builder) {
-  auto *FnTy =
-      cast<FunctionType>(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<Value *, 8> CallArgs;


        


More information about the llvm-commits mailing list