It's been a month.  Ping!

I disabled late-combine for CRIS, so to expose the bug for
current master, you'll need to enable that pass explicitly
when testing, e.g like "make -k check-gcc-c
RUNTESTFLAGS=--target_board=cris-sim/-flate-combine-instructions\
cris.exp=rld-legit2.c"

I verified that the patch still works around the issue at
r15-2881-g4bcb480d103b.

brgds, H-P

> From: Hans-Peter Nilsson <h...@axis.com>
> Date: Fri, 12 Jul 2024 03:17:39 +0200
> 
> CC to both the combine maintainer and the RA maintainer for
> verdict on whether this is the true correction or just a
> "fix"; whether REG_POINTER must be present or is just an
> optimization hint.  And I almost forgot, the late-combine
> author!  At least I hope to clarify the commit log based on
> your replies.  Please also see PR115883.
> 
> Tested cris-elf, where the ICEs are gone.  Test-results need another
> patch to be restored ante late-combine, though.  Also regtested native
> x86_64-pc-linux-gnu.
> 
> Ok to commit?
> 
> -- >8 --
> The first of the late-combine passes, propagates some of the copies
> made during the (in-time-)combine pass in make_more_copies into the
> users of the "original" pseudo registers and removes the "old"
> pseudos.  That effectively removes attributes such as REG_POINTER,
> which matter to LRA.  I *think* the actual bug causing the ICEs in the
> PR is in LRA.  Either that, or this is the actual bug and REG_POINTER
> *must* be present for registers used to form base addresses going into
> IRA and LRA.  But the documentation doesn't support that claim,
> AFAICS.
> 
> Anyway, this patch corrects state for those propagated uses to ante
> late-combine.
> 
>       PR middle-end/115883
>       * combine.cc (make_more_copies): Copy attributes from the original
>       pseudo to the new copy.
> ---
>  gcc/combine.cc | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/gcc/combine.cc b/gcc/combine.cc
> index 3b50bc3529c4..6e6e710aae08 100644
> --- a/gcc/combine.cc
> +++ b/gcc/combine.cc
> @@ -15102,6 +15102,12 @@ make_more_copies (void)
>           continue;
>  
>         rtx new_reg = gen_reg_rtx (GET_MODE (dest));
> +
> +       // The "original" pseudo copies have important attributes
> +       // attached, like pointerness.  We want that for these copies
> +       // too, for use by insn recognition and later passes.
> +       set_reg_attrs_from_value (new_reg, dest);
> +
>         rtx_insn *new_insn = gen_move_insn (new_reg, src);
>         SET_SRC (set) = new_reg;
>         emit_insn_before (new_insn, insn);
> -- 
> 2.30.2
> 

Reply via email to