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.
> 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. 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.
Jakub