https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64833

--- Comment #14 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Kazumoto Kojima from comment #12) 
> diff --git a/config/sh/sh.c b/config/sh/sh.c
> index 0139095..86cbea7 100644
> --- a/config/sh/sh.c
> +++ b/config/sh/sh.c
> @@ -5261,6 +5261,11 @@ find_barrier (int num_mova, rtx_insn *mova, rtx_insn
> *from)
>              && GET_CODE (PATTERN (from)) == UNSPEC_VOLATILE
>              && XINT (PATTERN (from), 1) == UNSPECV_CONST_END)
>       return from;
> +      /* get_attr_length might return the length of the original worker
> +      for casesi_worker_2.  Get uncached length for it.  */
> +      else if (NONJUMP_INSN_P (from)
> +            && recog_memoized (from) == CODE_FOR_casesi_worker_2)
> +     inc = insn_default_length (from);
>  
>        if (BARRIER_P (from))
>       {

I was trying to understand what's happening there ... it's a bit confusing.  A
cleaner way would probably be to add a function in final.c to update the cached
length value for the INSN_UID in final.c.  Then, invoke that function for the
insn in fixup_mova when the pattern rtx is changed from casesi_worker_1 to
casesi_worker_2.  However, I guess that all the other insn length dependent
values will have to be re-calculated to get a consistent state.

Wouldn't it be easier/safer to just set the length of casesi_worker_1 to "8"?

Reply via email to