[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 17:04:12 PDT 2024
================
@@ -414,9 +414,20 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
void CGHLSLRuntime::setHLSLFunctionAttributes(const FunctionDecl *FD,
llvm::Function *Fn) {
- if (FD->isInExportDeclContext()) {
- const StringRef ExportAttrKindStr = "hlsl.export";
- Fn->addFnAttr(ExportAttrKindStr);
+ if (FD) { // "explicit" functions with declarations
+ if (FD->isInExportDeclContext()) {
+ const StringRef ExportAttrKindStr = "hlsl.export";
+ Fn->addFnAttr(ExportAttrKindStr);
+ }
+ // Respect noinline if the explicit functions use it
+ // otherwise default to alwaysinline
+ if (!Fn->hasFnAttribute(Attribute::NoInline))
+ Fn->addFnAttr(llvm::Attribute::AlwaysInline);
+ } else { // "implicit" autogenerated functions with no declaration
+ // Implicit functions might get marked as noinline by default
+ // but we override that for HLSL
+ Fn->removeFnAttr(Attribute::NoInline);
----------------
llvm-beanz wrote:
Which auto-generated functions are getting noinline attached to them? Do you know where that is happening?
https://github.com/llvm/llvm-project/pull/106588
More information about the cfe-commits
mailing list