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

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 09:13:29 PDT 2024


================
@@ -1239,9 +1239,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
   if (getLangOpts().OpenMP && CurCodeDecl)
     CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl);
 
-  if (FD && getLangOpts().HLSL) {
+  if (getLangOpts().HLSL) {
     // Handle emitting HLSL entry functions.
-    if (FD->hasAttr<HLSLShaderAttr>()) {
+    if (FD && FD->hasAttr<HLSLShaderAttr>()) {
       CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
     }
     CGM.getHLSLRuntime().setHLSLFunctionAttributes(FD, Fn);
----------------
pow2clk wrote:

Yeah, the `emitFunctionProlog` form is how it looked in an earlier version of a change Helena made. I think it was #102275 which introduced `setHLSLFucntionAttributes`. I decided to follow her lead, but I don't know the reasoning behind it. 

This becomes moot with the new approach I'm taking. 

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


More information about the cfe-commits mailing list