[llvm] e81f566 - [Coroutines] Avoid pointer element access for resume function type
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 9 05:47:25 PST 2022
Author: Nikita Popov
Date: 2022-03-09T14:47:17+01:00
New Revision: e81f566de6face419813f8aae200921ef709c8d8
URL: https://github.com/llvm/llvm-project/commit/e81f566de6face419813f8aae200921ef709c8d8
DIFF: https://github.com/llvm/llvm-project/commit/e81f566de6face419813f8aae200921ef709c8d8.diff
LOG: [Coroutines] Avoid pointer element access for resume function type
For switch ABI, the function type is always "void (%frame*)", so
just hardcode that rather than fetching it from a pointer element
type.
Added:
Modified:
llvm/lib/Transforms/Coroutines/CoroInternal.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Coroutines/CoroInternal.h b/llvm/lib/Transforms/Coroutines/CoroInternal.h
index 797c8987e9850..110e0e0680e52 100644
--- a/llvm/lib/Transforms/Coroutines/CoroInternal.h
+++ b/llvm/lib/Transforms/Coroutines/CoroInternal.h
@@ -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();
More information about the llvm-commits
mailing list