[Bug tree-optimization/57303] [4.7/4.8 Regression] struct miscompiled at -O1 and above
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 21 14:00:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57303
--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #7)
> On Mon, 20 May 2013, glisse at gcc dot gnu.org wrote:
> > + /* Remove *p = *p. */
> > + if (!inplace && TREE_CODE_CLASS (subcode) == tcc_reference
> > + && operand_equal_p (lhs, gimple_assign_rhs1 (stmt), 0))
> > + {
> > + gsi_remove (gsi, true);
> > + return true;
> > + }
>
> The obvious place would be dead store elimination. But beware that
> the above, if not _literally_ being *p = *p can be changing the
> effective type of the memory location and thus might be not dead
> in terms of type-based aliasing rules (which basically means that
> we need to do sth more clever than just removing the store).
So operand_equal_p on a tcc_reference is not enough? Aliasing is complicated, I
guess I'll open a PR about this optimization.
More information about the Gcc-bugs
mailing list