> On Jan 29, 2026, at 11:39, Jakub Jelinek <[email protected]> wrote: > > On Thu, Jan 29, 2026 at 04:08:46PM +0000, Qing Zhao wrote: >>> Well, inlining is recorded in debug info. >> >> Okay, that’s good to know. So, user can examine the debug section in binary >> to get the inlining information? > > There is information on which routines have been inlined into what, just > readelf -wi and look for DW_TAG_inlined_subroutine tags, with > DW_AT_abstract_origin pointing to what has been inlined at that point. > There are no details why the inliner chose to inline something and not > something else.
Thanks a lot for the detailed information. This is helpful. > >> How about the profiling information, especially which routines are optimized >> by using the profiling info? Is such info recorded in binary? > > That is very fuzzy, we don't really track what exact optimizations we've > done based on profile info and what for other reasons. > You can look again at DW_AT_producer in debug info, if a function is in > a TU compiled with -fprofile-use, then presumably it has been optimized > using the profiling info. Though, that just mostly means when reading the > *.gcda files it initialized edge probabilities and bb counts from the > observed counts rather than from heuristics. And optimizations then just > use those probabilities/counts to decide on optimizations. Sure, > -fprofile-use doesn't do just that, but still. You can find out if > probabilities/counts were *.gcda based or heuristics based, but not whether > anything actually used that info in some way and for what. So, you mean that the “DW_AT_producer” tag in the binary can distinguish whether a routine uses real profiling data or only heuristics? If so, I guess that will be useful too. > Especially not > whether the probabilities/counts were different enough from heuristic based > ones to result in different optimization decisions. You'd need to compile > twice, once without -fprofile-use, and compare. one question here: if one routine whose profiling data is available in *.gcda, but the profiling data is bad due to some reason, as a result, the profiling data is ignored. Is there “DW_AT_producer” tag for such routine? Qing > > Jakub >
