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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Or just:

struct A { double a, b; };
struct B : A {};
double f(B x){
  B y;
  A*px=&x;
  A*py=&y;
  *py=*px;
  return y.a;
}

  MEM[(struct A *)&y] = MEM[(const struct A &)&x];
  y_6 = MEM[(struct A *)&y];
  y ={v} {CLOBBER};
  return y_6;

where y_6 should be read directly from x. SRA doesn't dare touch it. SCCVN does
see that reading from y is equivalent to reading from x, but unless something
else is already reading from x, it keeps the read from y.

Reply via email to