[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 13:36:16 PDT 2024
================
@@ -2502,9 +2505,16 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
ShouldAddOptNone &= !D->hasAttr<MinSizeAttr>();
ShouldAddOptNone &= !D->hasAttr<AlwaysInlineAttr>();
- // Add optnone, but do so only if the function isn't always_inline.
- if ((ShouldAddOptNone || D->hasAttr<OptimizeNoneAttr>()) &&
- !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
+ // Non-entry HLSL functions must always be inlined.
+ if (getLangOpts().HLSL && !F->hasFnAttribute(llvm::Attribute::NoInline)) {
+ if (D->hasAttr<NoInlineAttr>())
+ getDiags().Report(D->getLocation(),
+ diag::warn_unsupported_attribute_ignored)
+ << "noinline" << "HLSL";
----------------
llvm-beanz wrote:
Why are we warning on this? Does the Clang implementation not work?
If we're going to warn on this, it needs to be in Sema not CodeGen!
https://github.com/llvm/llvm-project/pull/106588
More information about the cfe-commits
mailing list