At present, inlining in HLSL follows the existing heuristics which will inline if the function is short enough. To be correct in HLSL, we need to inline all non-entry functions. To do this we need to annotate either calls or function definitions (or some combination of both) as alwaysinline so that the inliner forces them to be inlined.
For HLSL shader and library targets, automatically apply the alwaysinline attribute to non-entry functions with tests regardless of qualifiers. The exception is the autogenerated unmangled main() function
Note that there are cases where not everything should be inlined (eg noinline attribute). This is out of scope for this issue.
Summary
At present, inlining in HLSL follows the existing heuristics which will inline if the function is short enough. To be correct in HLSL, we need to inline all non-entry functions. To do this we need to annotate either calls or function definitions (or some combination of both) as alwaysinline so that the inliner forces them to be inlined.
For HLSL shader and library targets, automatically apply the alwaysinline attribute to non-entry functions with tests regardless of qualifiers. The exception is the autogenerated unmangled main() function
Note that there are cases where not everything should be inlined (eg noinline attribute). This is out of scope for this issue.