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

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 17:10:48 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"))
----------------
pow2clk wrote:

In earlier discussion, we resolved to make this the default and not worry about noinline as of yet seeing as there are a lot of issues to resolve before that can work properly. In a previous version, I was forced to check for noinline as it was a sign that a function had passed through this function, but my preference is to not respect it until we've worked out the issues that prevent it from working right. 

 It wouldn't simplify the logic since the entry function doesn't get marked inline until it is passed into this function. 

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


More information about the cfe-commits mailing list