Add -ftime-trace instrumentation for the inliner pass#22911
Add -ftime-trace instrumentation for the inliner pass#22911thewilsonator merged 2 commits intodlang:masterfrom
Conversation
noticed the inliner pass was invisible in -ftime-trace output — was looking at a trace after dlang#22825 and realized the whole inlining phase just disappears. added inlineGeneral and per-function inline spans following the same pattern as the existing sema/parse spans. makes it possible to see which functions are taking time during inlining, useful for diagnosing compile-time issues in codebases that use -inline heavily.
|
Thanks for your pull request and interest in making D better, @suyashkumar102! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#22911" |
|
Thanks for doing this. Btw, while you have your brain cache partially filled with details on inlining, would it be possible for you to investigate why |
|
@nordlow Tried it out.
Seems this is Issue #18337. Good timing since I'm already deep in the inliner code. |

After PR #22825 I kept looking at traces and noticed the inliner pass just
doesn't show up. When compiling with
-inline -ftime-trace, the trace showsSemantic analysisfollowed byCode generation— nothing in between.The frontend inliner can contribute to compile-time slowdowns in some codebases, and having visibility into its activity may help when investigating such cases. For example, #20315 highlights a situation where the inliner was suspected to play a role in increased compile times, and there was nothing in the trace to look at when diagnosing it.
This adds two new event types:
Inlining— top-level span covering the entire inliner passInline: <function>— per-function span for each function scannedThe Inlining span covers both the pragma-inline scan and the full -inline scan.
ftimetrace_inline.dcompiled with -inline:ftimetrace_pragma.dcompiled without -inline :spans showing the inliner working through the divide-and-conquer tree:
Updated
ftimetrace.dand addedftimetrace_inline.dandftimetrace_pragma.dto cover all cases.