[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 07:56:53 PST 2025
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 6d86a8a1a12856955aba5e06a6552ddafaaa208f 26e26100711b92a946180450d31f265647cfaba4 --extensions h,cpp -- clang/lib/CodeGen/CGCoroutine.cpp clang/test/CodeGenCoroutines/coro-gro.cpp clang/test/CodeGenCoroutines/coro-params.cpp llvm/include/llvm/Transforms/Coroutines/CoroInstr.h llvm/include/llvm/Transforms/Coroutines/CoroShape.h llvm/lib/Transforms/Coroutines/CoroSplit.cpp llvm/lib/Transforms/Coroutines/Coroutines.cpp llvm/lib/Transforms/Coroutines/SpillUtils.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp
index e2d06f33dd..0364cae9af 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -709,7 +709,8 @@ struct GetReturnObjectManager {
auto *GroAlloca = dyn_cast_or_null<llvm::AllocaInst>(
GroEmission.getOriginalAllocatedAddress().getPointer());
assert(GroAlloca && "expected alloca to be emitted");
- Builder.CreateCall(CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_outside_frame), {GroAlloca});
+ Builder.CreateCall(
+ CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_outside_frame), {GroAlloca});
// Remember the top of EHStack before emitting the cleanup.
auto old_top = CGF.EHStack.stable_begin();
@@ -858,8 +859,11 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
// If the original param is in an alloca, exclude it from the coroutine
// frame. The parameter copy will be part of the frame.
Address ParmAddr = GetAddrOfLocalVar(Parm);
- if (auto *ParmAlloca = dyn_cast<llvm::AllocaInst>(ParmAddr.getBasePointer())) {
- Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::coro_outside_frame), {ParmAlloca});
+ if (auto *ParmAlloca =
+ dyn_cast<llvm::AllocaInst>(ParmAddr.getBasePointer())) {
+ Builder.CreateCall(
+ CGM.getIntrinsic(llvm::Intrinsic::coro_outside_frame),
+ {ParmAlloca});
}
}
for (auto *PM : S.getParamMoves()) {
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index 9bfb8f5dca..32b10488d2 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -801,7 +801,9 @@ class CoroOutsideFrameInst : public IntrinsicInst {
enum { PtrArg };
public:
- Value *getPtr() const { return getArgOperand(PtrArg); } // XXX: Could we require it to be an alloca?
+ Value *getPtr() const {
+ return getArgOperand(PtrArg);
+ } // XXX: Could we require it to be an alloca?
// Methods to support type inquiry through isa, cast, and dyn_cast:
static bool classof(const IntrinsicInst *I) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/127653
More information about the llvm-commits
mailing list