Author: Nikita Popov Date: 2026-07-08T09:09:45+02:00 New Revision: 7ca17050c766ff1a1bd4bc74525f018ba1d9a104
URL: https://github.com/llvm/llvm-project/commit/7ca17050c766ff1a1bd4bc74525f018ba1d9a104 DIFF: https://github.com/llvm/llvm-project/commit/7ca17050c766ff1a1bd4bc74525f018ba1d9a104.diff LOG: [CodeGen] Set attributes on coroutine wrapper functions (#207961) Call SetInternalFunctionAttributes() so that target feature attributes get set. This ensures that inlining works without having to reason about target-specific inline compatibility logic. Added: Modified: clang/lib/CodeGen/CGCoroutine.cpp clang/test/CodeGenCoroutines/coro-elide.cpp clang/test/CodeGenCoroutines/coro-halo.cpp clang/test/CodeGenCoroutines/pr65018.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp index c1ea145934143..bf896f1338ab4 100644 --- a/clang/lib/CodeGen/CGCoroutine.cpp +++ b/clang/lib/CodeGen/CGCoroutine.cpp @@ -437,6 +437,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName, llvm::Function *Fn = llvm::Function::Create( LTy, llvm::GlobalValue::InternalLinkage, FuncName, &CGM.getModule()); + CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI); Fn->addParamAttr(0, llvm::Attribute::AttrKind::NonNull); Fn->addParamAttr(0, llvm::Attribute::AttrKind::NoUndef); @@ -444,6 +445,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName, Fn->addParamAttr(1, llvm::Attribute::AttrKind::NoUndef); Fn->setMustProgress(); + Fn->removeFnAttr(llvm::Attribute::AttrKind::NoInline); Fn->addFnAttr(llvm::Attribute::AttrKind::AlwaysInline); Fn->addFnAttr("sample-profile-suffix-elision-policy", "selected"); diff --git a/clang/test/CodeGenCoroutines/coro-elide.cpp b/clang/test/CodeGenCoroutines/coro-elide.cpp index 3bff2a29c6e07..1902dd64b5e5a 100644 --- a/clang/test/CodeGenCoroutines/coro-elide.cpp +++ b/clang/test/CodeGenCoroutines/coro-elide.cpp @@ -1,8 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm %s -o - | FileCheck %s -// FIXME: Generate wrappers with correct target features. -// REQUIRES: x86-registered-target - #include "Inputs/coroutine.h" namespace { diff --git a/clang/test/CodeGenCoroutines/coro-halo.cpp b/clang/test/CodeGenCoroutines/coro-halo.cpp index 6dd785f5c1f8e..e75bedaf81fa2 100644 --- a/clang/test/CodeGenCoroutines/coro-halo.cpp +++ b/clang/test/CodeGenCoroutines/coro-halo.cpp @@ -3,9 +3,6 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm %s \ // RUN: -fcxx-exceptions -fexceptions -o - | FileCheck %s -// FIXME: Generate wrappers with correct target features. -// REQUIRES: x86-registered-target - #include "Inputs/coroutine.h" #include "Inputs/numeric.h" diff --git a/clang/test/CodeGenCoroutines/pr65018.cpp b/clang/test/CodeGenCoroutines/pr65018.cpp index f3b903dc0b396..f1cde461cabc2 100644 --- a/clang/test/CodeGenCoroutines/pr65018.cpp +++ b/clang/test/CodeGenCoroutines/pr65018.cpp @@ -1,9 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \ // RUN: -O1 -emit-llvm %s -o - | FileCheck %s -// FIXME: Generate wrappers with correct target features. -// REQUIRES: x86-registered-target - #include "Inputs/coroutine.h" // A simple awaiter type with an await_suspend method that can't be _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
