[PATCH] tree-dse: Fix mem* head trimming if call has lhs [PR94130]

Richard Biener rguenther@suse.de
Thu Mar 12 08:32:14 GMT 2020


On Thu, 12 Mar 2020, Jakub Jelinek wrote:

> On Thu, Mar 12, 2020 at 09:20:08AM +0100, Richard Biener wrote:
> > On Thu, 12 Mar 2020, Jakub Jelinek wrote:
> > 
> > > Hi!
> > > 
> > > As the testcase shows, if DSE decides to head trim {mem{set,cpy,move},strncpy}
> > > and the call has lhs, it is incorrect to leave the lhs as is, because it
> > > will then point to the adjusted address (base + head_trim) instead of the
> > > original base.
> > > The following patch fixes that by dropping the lhs of the call and assigning
> > > lhs the original base in a following statement.
> > > 
> > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> > 
> > OK, but I don't see where you need anything additional frmo gimplify.h?
> 
> unshare_expr here:
> > > +	gassign *newop = gimple_build_assign (lhs, unshare_expr (*where));
> 
> While SSA_NAMEs obviously don't need to be unshared, if it is a gimple
> invariant, it might need to be.

Ah, ok.

Richard.


More information about the Gcc-patches mailing list