On Thu, Jan 31, 2019 at 4:02 PM Jakub Jelinek <ja...@redhat.com> wrote: > > On Thu, Jan 31, 2019 at 03:56:12PM +0100, Richard Biener wrote: > > Don't you alreday have > > > > @@ -4200,10 +4202,34 @@ pass_sprintf_length::execute (function *fun) > > init_target_to_host_charmap (); > > > > calculate_dominance_info (CDI_DOMINATORS); > > + bool optimizing_late = optimize > 0 && fold_return_value; > > + if (optimizing_late) > > + { > > + /* ?? We should avoid changing the CFG as much as possible. > > ... > > + loop_optimizer_init (LOOPS_HAVE_PREHEADERS); > > + scev_initialize (); > > + } > > > > so loops are only initialized if fold_return_value is true? Ah - but that's > > the pass parameter from params.def rather than the flag to enable > > the folding... So indeed, change it to include && flag_printf_return_value > > fold_return_value is not the same thing as flag_printf_return_value, > the former is just a bool whether it is the -O0 or -O1+ version of the pass. > So, optimizing_late doesn't make much sense, one can use optimize > 0 > directly instead. > > If changing the above to && flag_printf_return_value then people will > complain that they get the false positive warning with -Wall > -fno-printf-return-value.
Sure - too bad then. Another option would be to make SCEV / niter analysis "safe" to be called with LOOPS_AVOID_CFG_MANIPULATIONs (multiple latches, multiple entries into headers, etc.). Richard. > Jakub