[clang] [llvm] [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (PR #89751)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 05:43:24 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff c52b18d1e41107067b7557d8af3a06e6fe0beb0f 33b07efe6d68cb4d17e96349b552ef5e5901d8c6 -- clang/lib/CodeGen/CGCoroutine.cpp clang/test/CodeGenCoroutines/coro-await.cpp clang/test/CodeGenCoroutines/coro-symmetric-transfer-01.cpp clang/test/CodeGenCoroutines/coro-symmetric-transfer-02.cpp llvm/lib/Transforms/Coroutines/CoroInstr.h llvm/lib/Transforms/Coroutines/CoroInternal.h llvm/lib/Transforms/Coroutines/CoroSplit.cpp llvm/lib/Transforms/Coroutines/Coroutines.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 01eb75617e..ff037518cb 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -212,7 +212,8 @@ static void lowerAwaitSuspend(IRBuilder<> &Builder, CoroAwaitSuspendInst *CB,
if (CB->getCalledFunction()->getIntrinsicID() ==
Intrinsic::coro_await_suspend_handle) {
- // Follow the await_suspend by a lowered resume call to the returned coroutine.
+ // Follow the await_suspend by a lowered resume call to the returned
+ // coroutine.
if (auto *Invoke = dyn_cast<InvokeInst>(CB))
Builder.SetInsertPoint(Invoke->getNormalDest()->getFirstInsertionPt());
@@ -220,7 +221,7 @@ static void lowerAwaitSuspend(IRBuilder<> &Builder, CoroAwaitSuspendInst *CB,
auto *ResumeAddr = LB.makeSubFnCall(NewCall, CoroSubFnInst::ResumeIndex,
&*Builder.GetInsertPoint());
- LLVMContext& Ctx = Builder.getContext();
+ LLVMContext &Ctx = Builder.getContext();
FunctionType *ResumeTy = FunctionType::get(
Type::getVoidTy(Ctx), PointerType::getUnqual(Ctx), false);
auto *ResumeCall = Builder.CreateCall(ResumeTy, ResumeAddr, {NewCall});
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index d891173156..1a92bc1636 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -48,7 +48,7 @@ coro::LowererBase::LowererBase(Module &M)
// call ptr @llvm.coro.subfn.addr(ptr %Arg, i8 %index)
CallInst *coro::LowererBase::makeSubFnCall(Value *Arg, int Index,
- Instruction *InsertPt) {
+ Instruction *InsertPt) {
auto *IndexVal = ConstantInt::get(Type::getInt8Ty(Context), Index);
auto *Fn = Intrinsic::getDeclaration(&TheModule, Intrinsic::coro_subfn_addr);
``````````
</details>
https://github.com/llvm/llvm-project/pull/89751
More information about the cfe-commits
mailing list