[Bug tree-optimization/79716] memset followed by overwrite not eliminated

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jun 1 09:38:00 GMT 2019


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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Confirmed.  The issue is that DSE does not track variable-size stores like
> this
> and thus stmt_kills_ref_p (temp, ref) returns false for memcpy and the ref
> for memset (which ends up with unknown size).

The most obvious example for this is probably

void f(char*p,unsigned long n){
  __builtin_memset(p,0,n);
  __builtin_memset(p,255,n);
}

where GIMPLE really has just those 2 statements, and we fail to remove the
first one.


More information about the Gcc-bugs mailing list