On Fri, Sep 25, 2026 at 11:29 AM Tobias Burnus <[email protected]> wrote:
>
> Richard Biener wrote:
> > Looks good, but how we get to pass == 3 is totally non-obvious ...  why 
> > make it
> > conditional on pass == 3 only?
>
> Maybe, we should add a comment to the code like:
>
> --- a/gcc/lto-streamer-in.cc
> +++ b/gcc/lto-streamer-in.cc
> @@ -2141,5 +2141,6 @@ lto_input_mode_table (struct lto_file_decl_data 
> *file_data)
>          }
>         /* First search just the GET_CLASS_NARROWEST_MODE to wider modes,
> -        if not found, fallback to all modes.  */
> +        if not found, fallback to all modes.  When found, pass is 3 (2 + 1),
> +        when not found, pass is 2 ('< 2' check + 1).  */
>         int pass;
>         for (pass = 0; pass < 2; pass++)
>
>
> Namely, the when found there is:
>
>            else
>              {
>                table[m] = mr;
>                pass = 2;
>                break;
>              }
>
> Thus, 'pass == 2' in the inner loop. In the outer loop is first the increment
> and then the 'pass < 2' check - such that the value is 3.
>
> If not found, the inner loop ends with doing nothing (if -> 'continue' for the
> inner loop), such that 'pass' is incremented until larger then 2, i.e. being 
> 3.
>
>
> Thus, how about the patch plus adding a comment like above?

That would be nice, yes.   But then the check could also be moved into
that 'else'?

>
> Tobias
>

Reply via email to