On Thu, Jan 29, 2026 at 05:21:01PM +0000, Qing Zhao wrote:
> 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?
DW_AT_producer is an attribute of DW_TAG_compile_unit (or similar tags), so
applies to all functions within the translation unit.
So it tells you whether a particular TU has been compiled with -fprofile-use
or not. I believe bad profiling data isn't an on or off case, if it is only
slightly bad, -fprofile-correction can tweak it and still apply. And
without -fprofile-correction there are warnings or errors.
Jakub