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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-09-02
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Richard Biener from comment #2)
> > p *ref
> > $9 = {ref = <component_ref 0x7ffff48513c0>, base = <var_decl
> > 0x7ffff4fe5ab0>, 
> >   offset = {coeffs = {320}}, size = {coeffs = {8}}, max_size = {coeffs =
> > {8}}, 
> >   ref_alias_set = 21, base_alias_set = 0, volatile_p = false}
> > 
> > so the load has alias-set zero and thus conflicts with SR.93_7->i.  It has
> > alias-set zero because _Optional_payload_base has TYPE_TYPELESS_STORAGE.
> 
> Though a store of a zero that does change a value of a zero.

Hmm, yes.  So in principle there's code to handle that, but it only
opportunistically skips CONSTANT_CLASS_P rhs, not CTOR.  We also only
skip stores of the same type (we're later using operand_equal_p), so
never aggregate copies.  Fixable, I guess.  Still it would require
quite some refactoring of the validity checking - you need to ensure
the = {} store will be not a partial def of the lookup (in this case
we're looking up a byte store, so "easy", but in a more general case).

It's the

      /* If we reach a clobbering statement try to skip it and see if
         we find a VN result with exactly the same value as the
         possible clobber.  In this case we can ignore the clobber
         and return the found value.  */

code in tree-ssa-sccvn.cc that does this.

I'll queue this.

Reply via email to