-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Coroutines] fix coroutines + std::unique_ptr with async exceptions validation errors #149691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
6ccbdcd
1d303ca
887bcb2
7f00eeb
5899a93
0b8e37a
428d6b4
ffe4587
c8b944c
8fa7b44
9ec807f
3c5929a
3551cc8
c4795ae
dbafc22
0e1afdf
380a643
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,7 +376,16 @@ static void replaceUnwindCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape, | |
| // If coro.end has an associated bundle, add cleanupret instruction. | ||
| if (auto Bundle = End->getOperandBundle(LLVMContext::OB_funclet)) { | ||
| auto *FromPad = cast<CleanupPadInst>(Bundle->Inputs[0]); | ||
| auto *CleanupRet = Builder.CreateCleanupRet(FromPad, nullptr); | ||
|
|
||
| // If the terminator is an invoke, | ||
| // set the cleanupret unwind destination the same as the other edges, to | ||
| // avoid validation errors | ||
|
||
| BasicBlock *UBB = nullptr; | ||
| if (auto II = dyn_cast<InvokeInst>(FromPad->getParent()->getTerminator())) { | ||
| UBB = II->getUnwindDest(); | ||
| } | ||
|
|
||
| auto *CleanupRet = Builder.CreateCleanupRet(FromPad, UBB); | ||
| End->getParent()->splitBasicBlock(End); | ||
| CleanupRet->getParent()->getTerminator()->eraseFromParent(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks expensive. Is it possible to avoid this do-while?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, this while was redundant and I removed it.