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

            Bug ID: 119997
           Summary: [13/14/15/16 Regression] PRE no longer hoists
                    &ptr->field
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Since r13-137-gee1cb43bc76de8 PRE no longer hoists the invariant address
computations in gcc.target/i386/pr109362.c:

struct S { long a, b; };

int
foo (struct S *v)
{
  while (1)
    {
      __atomic_load_n (&v->a, __ATOMIC_ACQUIRE);
      if (__atomic_load_n (&v->b, __ATOMIC_ACQUIRE))
        return 1;
    }
}


  <bb 2> [local count: 118111600]:

  <bb 3> [local count: 1073741824]:
  _1 = &v_6(D)->a;
  __atomic_load_8 (_1, 2);
  _2 = &v_6(D)->b;
  _3 = __atomic_load_8 (_2, 2);
  if (_3 != 0)
    goto <bb 4>; [11.00%]
  else
    goto <bb 5>; [89.00%]

  <bb 5> [local count: 955630224]:
  goto <bb 3>; [100.00%]


since PRE in compute_avail() relies on vn_reference_lookup_pieces to lookup
the address but that a) did not get the special-handling of such addresses
so we can't find the inserted expression, b) it relies on the vn_reference
instead of just wanting a value, but we internally handle it as vn_nary.

Reply via email to