Bernd Edlinger <bernd.edlin...@hotmail.de> writes:
> --- gcc/config/mips/mips.c.jj 2015-06-08 23:06:50.000000000 +0200
> +++ gcc/config/mips/mips.c    2015-07-03 13:16:02.637293167 +0200
> @@ -9902,8 +9902,11 @@ mips_cfun_has_inflexible_gp_ref_p (void)
>  static bool
>  mips_insn_has_flexible_gp_ref_p (rtx_insn *insn)
>  {
> -  return (get_attr_got (insn) != GOT_UNSET
> -       || mips_small_data_pattern_p (PATTERN (insn))
> +  rtx_insn *subinsn;
> +  FOR_EACH_SUBINSN (subinsn, insn)
> +    if (get_attr_got (subinsn) != GOT_UNSET)
> +      return true;
> +  return (mips_small_data_pattern_p (PATTERN (insn))
>         || reg_overlap_mentioned_p (pic_offset_table_rtx, PATTERN (insn)));
>  }
>  

The final return here would also mishandle SEQUENCE PATTERNs.
The idea was that this function would only see "real" instructions,
so I think instead the FOR_EACH_SUBINSN should be here:

static bool
mips_find_gp_ref (bool *cache, bool (*pred) (rtx_insn *))
{
  rtx_insn *insn;

  if (!*cache)
    {
      push_topmost_sequence ();
      for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
---->
        if (USEFUL_INSN_P (insn) && pred (insn))

Thanks,
Richard

Reply via email to