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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I think this is caused by misoptimizing
     void **x;
     void *info ATTRIBUTE_UNUSED;
{
  cselib_val *v = (cselib_val *)*x;
  struct elt_loc_list **p = &v->locs;
  int had_locs = v->locs != 0;

  while (*p)
    {
      if (references_value_p ((*p)->loc, 1))
        unchain_one_elt_loc_list (p);
      else
        p = &(*p)->next;
    }

  if (had_locs && v->locs == 0)
    {
      n_useless_values++;
      values_became_useless = 1;
    }
  return 1;
}

where fre1 after type cleaning concludes that v->locs is unchanged while it is
unchanged in:

static void
unchain_one_elt_loc_list (pl)
     struct elt_loc_list **pl;
{
  struct elt_loc_list *l = *pl;

  *pl = l->next;
  l->next = empty_elt_loc_lists;
  empty_elt_loc_lists = l;
}

So it seems that in some cases alias analysis gets lost in pointer dereferences
while we are still in early optimization. 

Perhaps we want to produce alias sets earlier?

Honza

Reply via email to