[Bug tree-optimization/77485] Missed dead store elimination of aggregate store followed by partial stores
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Wed Dec 14 08:14:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77485
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 14 Dec 2016, law at redhat dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77485
>
> --- Comment #7 from Jeffrey A. Law <law at redhat dot com> ---
> There was a bit of cruft and a missed ADDR_EXPR in that last fragment of gimple
> code.
>
> ;; basic block 2, loop depth 0, count 0, freq 0, maybe hot
> ;; prev block 0, next block 1, flags: (NEW, REACHABLE, VISITED)
> ;; pred: ENTRY (FALLTHRU,EXECUTABLE)
> __builtin_memset (&MEM[(struct FixBuf *)&<retval> + 31B], 0, 169);
> <retval>.buf[0] = 48;
> <retval>.buf[1] = 32;
> [ ... ]
> return <retval>;
It also shows another (awkward) detail of the transform -- a previously
non-TREE_ADDRESSABLE <retval> becomes TREE_ADDRESSABLE. This
generally invalidates points-to (though in this particular case should
be harmless). It also possibly pessimizes alias analysis because
pointers pointing to unknown stuff now also alias <retval> while
previously not (non-TREE_ADDRESSABLE decls are not aliased).
This is why we generally prefer
decl = {};
over a memset. If you just chop off elements from the head/tail
you can keep the {} if you do
MEM <char[of-correct-size]> [&decl, off with original alias type]
= {}; (CONSTRUCTOR of same char[] type)
More information about the Gcc-bugs
mailing list