https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94482
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #14)
> The above testcase FAILs with all of 7/8/9/10, works with 6.
> -fno-tree-sra fixes it.
> Unless BIT_FIELD_REF with a non-SSA_NAME first operand is invalid on the lhs
> of assignment, I believe this is a SRA bug.
> Before SRA we have:
> z.j = { 0, 0, 0, 0 };
> BIT_FIELD_REF <z.i, 64, 0> = 1729;
> _11 = z.j;
> z ={v} {CLOBBER};
> z.j = _11;
> BIT_FIELD_REF <z.i, 64, 64> = 2;
> _6 = z.j;
> z ={v} {CLOBBER};
> z.j = _6;
> _3 = BIT_FIELD_REF <z.i, 64, 0>;
> if (_3 != 1729)
> but SRA transforms it into:
> z$j = { 0, 0, 0, 0 };
> BIT_FIELD_REF <z.i, 64, 0> = 1729;
> _19 = MEM[(union U *)&z];
> z$j = _19;
> _1 = z$j;
> _11 = _1;
> z$j ={v} {CLOBBER};
> z$j = _11;
> BIT_FIELD_REF <z.i, 64, 64> = 2;
> _15 = MEM[(union U *)&z];
> z$j = _15;
> _12 = z$j;
> _6 = _12;
> z$j ={v} {CLOBBER};
> z$j_22 = _6;
> MEM[(union U *)&z] = z$j_22;
> _3 = BIT_FIELD_REF <z.i, 64, 0>;
> if (_3 != 1729)
> which is definitely not equivalent.
They definitely are valid. It looks like SRA sets grp_partial_lhs for
the stores but forgets it for the load. Not sure why build_access_from_expr_1
special-cases BIT_FIELD_REF/IMAGPART/REALPART that way, possibly tied to
similar code in IL modification.