================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to