[Coroutines] Avoid pointer element access for resume function type
authorNikita Popov <npopov@redhat.com>
Wed, 9 Mar 2022 13:45:24 +0000 (14:45 +0100)
committerNikita Popov <npopov@redhat.com>
Wed, 9 Mar 2022 13:47:17 +0000 (14:47 +0100)
For switch ABI, the function type is always "void (%frame*)", so
just hardcode that rather than fetching it from a pointer element
type.

llvm/lib/Transforms/Coroutines/CoroInternal.h

index 797c898..110e0e0 100644 (file)
@@ -210,10 +210,9 @@ struct LLVM_LIBRARY_VISIBILITY Shape {
 
   FunctionType *getResumeFunctionType() const {
     switch (ABI) {
-    case coro::ABI::Switch: {
-      auto *FnPtrTy = getSwitchResumePointerType();
-      return cast<FunctionType>(FnPtrTy->getPointerElementType());
-    }
+    case coro::ABI::Switch:
+      return FunctionType::get(Type::getVoidTy(FrameTy->getContext()),
+                               FrameTy->getPointerTo(), /*IsVarArg*/false);
     case coro::ABI::Retcon:
     case coro::ABI::RetconOnce:
       return RetconLowering.ResumePrototype->getFunctionType();