[PATCH] D105504: [coro async] Move code to proper switch
Arnold Schwaighofer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 6 11:28:10 PDT 2021
aschwaighofer created this revision.
aschwaighofer added a reviewer: nate_chandler.
Herald added subscribers: lxfind, hiraditya.
aschwaighofer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
While upstreaming patches this code somehow was applied to the wrong switch statement.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105504
Files:
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -913,6 +913,21 @@
Shape.FrameSize, Shape.FrameAlign);
break;
case coro::ABI::Async: {
+ auto *ActiveAsyncSuspend = cast<CoroSuspendAsyncInst>(ActiveSuspend);
+ if (OrigF.hasParamAttribute(Shape.AsyncLowering.ContextArgNo,
+ Attribute::SwiftAsync)) {
+ uint32_t ArgAttributeIndices =
+ ActiveAsyncSuspend->getStorageArgumentIndex();
+ auto ContextArgIndex = ArgAttributeIndices & 0xff;
+ addAsyncContextAttrs(NewAttrs, Context, ContextArgIndex);
+
+ // `swiftasync` must preceed `swiftself` so 0 is not a valid index for
+ // `swiftself`.
+ auto SwiftSelfIndex = ArgAttributeIndices >> 8;
+ if (SwiftSelfIndex)
+ addSwiftSelfAttrs(NewAttrs, Context, SwiftSelfIndex);
+ }
+
// Transfer the original function's attributes.
auto FnAttrs = OrigF.getAttributes().getFnAttributes();
NewAttrs =
@@ -952,24 +967,9 @@
// followed by a return.
// Don't change returns to unreachable because that will trip up the verifier.
// These returns should be unreachable from the clone.
- case coro::ABI::Async: {
- auto *ActiveAsyncSuspend = cast<CoroSuspendAsyncInst>(ActiveSuspend);
- if (OrigF.hasParamAttribute(Shape.AsyncLowering.ContextArgNo,
- Attribute::SwiftAsync)) {
- uint32_t ArgAttributeIndices =
- ActiveAsyncSuspend->getStorageArgumentIndex();
- auto ContextArgIndex = ArgAttributeIndices & 0xff;
- addAsyncContextAttrs(NewAttrs, Context, ContextArgIndex);
-
- // `swiftasync` must preceed `swiftself` so 0 is not a valid index for
- // `swiftself`.
- auto SwiftSelfIndex = ArgAttributeIndices >> 8;
- if (SwiftSelfIndex)
- addSwiftSelfAttrs(NewAttrs, Context, SwiftSelfIndex);
- }
+ case coro::ABI::Async:
break;
}
- }
NewF->setAttributes(NewAttrs);
NewF->setCallingConv(Shape.getResumeFunctionCC());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105504.356785.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210706/b83564c5/attachment.bin>
More information about the llvm-commits
mailing list