Skip to content

Commit e81f566

Browse files
committed
[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.
1 parent acf77bd commit e81f566

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Coroutines/CoroInternal.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ struct LLVM_LIBRARY_VISIBILITY Shape {
210210

211211
FunctionType *getResumeFunctionType() const {
212212
switch (ABI) {
213-
case coro::ABI::Switch: {
214-
auto *FnPtrTy = getSwitchResumePointerType();
215-
return cast<FunctionType>(FnPtrTy->getPointerElementType());
216-
}
213+
case coro::ABI::Switch:
214+
return FunctionType::get(Type::getVoidTy(FrameTy->getContext()),
215+
FrameTy->getPointerTo(), /*IsVarArg*/false);
217216
case coro::ABI::Retcon:
218217
case coro::ABI::RetconOnce:
219218
return RetconLowering.ResumePrototype->getFunctionType();

0 commit comments

Comments
 (0)