[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 16:48:03 PDT 2024


================
@@ -2471,11 +2471,14 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
     B.addAttribute(llvm::Attribute::StackProtectReq);
 
   if (!D) {
+    // HLSL functions must always be inlined
+    if (getLangOpts().HLSL && !F->hasFnAttribute("hlsl.shader"))
----------------
llvm-beanz wrote:

What if we put `noinline` on the entry function? Does that simplify this logic? Since we'll also at some point need to support the `noinline` keyword we'll need to be checking that attribute somewhere.

https://github.com/llvm/llvm-project/pull/106588


More information about the cfe-commits mailing list