On Wed, Dec 17, 2025 at 2:59 AM Alexandre Oliva <[email protected]> wrote:
>
>
> When the last loc in a chain happens to be an unsuitable_loc(), we
> record VAR_LOC_FROM as if the empty location had been derived from
> that unsuitable loc, instead of leaving it empty, which ends up
> preventing the VAR loc from being recomputed when other related locs
> are usefully expanded.
>
> Adjust the code that skips an unsuitable_loc() to take the same
> preparation steps we take for exiting the loop as when an expansion
> attempt yields NULL_RTX.
>
> Regstrapped on x86_64-linux-gnu.  Ok to install?

OK.

> This came up while debugging a regression in guality/pr68860-[12].c with
> an about-to-be-submitted WIP patch that builds on
> https://gcc.gnu.org/pipermail/gcc-patches/2025-December/703497.html
> replacing invalidated REGs with a form containing their ADDRESS in
> cselib tables when invalidating REGs, but considering those RTL forms
> unsuitable_loc().
>
>
> for  gcc/ChangeLog
>
>         * var-tracking.cc (vt_expand_var_loc_chain): Prepare to exit
>         the loop after unsuitable_loc.
> ---
>  gcc/var-tracking.cc |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
> index 21cde6b0a7b6c..e0b9364a3d9e8 100644
> --- a/gcc/var-tracking.cc
> +++ b/gcc/var-tracking.cc
> @@ -8398,7 +8398,7 @@ vt_expand_var_loc_chain (variable *var, bitmap regs, 
> void *data,
>           next = loc;
>           cloc = cloc->next;
>           if (unsuitable_loc (loc_from))
> -           continue;
> +           goto try_next_loc;
>         }
>        else
>         {
> @@ -8438,6 +8438,7 @@ vt_expand_var_loc_chain (variable *var, bitmap regs, 
> void *data,
>           result = NULL;
>         }
>
> +    try_next_loc:
>        /* Set it up in case we leave the loop.  */
>        depth.complexity = depth.entryvals = 0;
>        loc_from = NULL;
>
>
> --
> Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
> Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity.
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to