On Fri, Jul 11, 2025 at 7:32 PM Jan Hubicka <hubi...@ucw.cz> wrote: > > > So with this the discriminator we assign might depend on whether > > we have debug stmts or not. We output them only to debug info, so > > it should in principle not cause compare-debug issues, right? And > > we don't use discriminators to affect code generation (hopefully). > > This is the reason of opts.cc change: > > diff --git a/gcc/opts.cc b/gcc/opts.cc > > index 6ca1ec7e865..60ad633b7ff 100644 > > --- a/gcc/opts.cc > > +++ b/gcc/opts.cc > > @@ -1411,11 +1411,14 @@ finish_options (struct gcc_options *opts, struct > > gcc_options *opts_set, > > opts->x_debug_info_level = DINFO_LEVEL_NONE; > > } > > > > + /* Also enable markers with -fauto-profile even when debug info is > > disabled, > > + so we assign same discriminators and can read back the profile info. > > */ > > if (!opts_set->x_debug_nonbind_markers_p) > > opts->x_debug_nonbind_markers_p > > = (opts->x_optimize > > - && opts->x_debug_info_level >= DINFO_LEVEL_NORMAL > > - && (dwarf_debuginfo_p (opts) || codeview_debuginfo_p ()) > > + && ((opts->x_debug_info_level >= DINFO_LEVEL_NORMAL > > + && (dwarf_debuginfo_p (opts) || codeview_debuginfo_p ())) > > + || opts->x_flag_auto_profile) > > && !(opts->x_flag_selective_scheduling > > || opts->x_flag_selective_scheduling2)); > > We only consume discriminators if we produce dwarf or if we do > auto-profile and they indeed must agree. With -Wauto-profile you now > get compiler complain if they does not. > > I enable debug stmt markers in both cases, so discriminators should be > the same. I tested that on spec and it seems to work. As discussed on > IRC I will look into possibility of enabling compare_debug for > profiledbootstrap and autoprofiledbootstrap where it is currently off. > > We already have function to remove debug statements, so I guess we could > remove them after auto-profile annotate pass at -O0, that I plan to look > into incrementally now. My immediate plan is to fix the create_gcov > consumer, so things can be finally properly tested. > > Honza
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121045 -- H.J.