https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92152
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so this happens in visit_reference_op_store which hits
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Store matched earlier value, "
"value numbering store vdefs to matching vuses.\n");
changed |= set_ssa_val_to (vdef, SSA_VAL (vuse));
where I actually wondered if I could trigger wrong-code with it. The
counter-measure is
/* If the TBAA state isn't compatible for downstream reads
we cannot value-number the VDEFs the same. */
alias_set_type set = get_alias_set (lhs);
if (vnresult->set != set
&& ! alias_set_subset_of (set, vnresult->set))
resultsame = false;
but here we have v.i and v.f both of which get the alias-set of the union.
We later disambiguate u.i against *f via aliasing_component_refs_p which
correctly assesses that if u.i is the active union member then the load
via *f cannot alias it.
On x86_64 we optimize away the v.f store as redundant but then still
don't CSE because somehow aliasing_component_refs_p doesn't get it in
the case both fields are not of the same size.
So I'm not entirely sure it isn't aliasing_component_refs_p that is to blame.
At least it should make the testcase also fail on x86_64...
Honza?