On Thu, 24 Nov 2016, Jakub Jelinek wrote: > On Thu, Nov 24, 2016 at 01:18:37PM +0100, Richard Biener wrote: > > > eg: > > > void *f(void *a1, void *a2, __SIZE_TYPE__ a3) > > > { > > > void *t1 = __builtin_memcpy (a1, a2, a3); > > > return t1; > > > } > > > > > > After patch, copyprop transformed it into: > > > t1 = __builtin_memcpy (a1, a2, a3); > > > return a1; > > > > But that's a bad transform -- if we know that t1 == a1 then it's > > better to use t1 as that's readily available in the return register > > while the register for a1 might have been clobbered and thus we > > need to spill it for the later return. > > I thought that the RA is aware of this and is able to undo it.
The RA has some feature here, yes. Not sure what it can do exactly and if it can do something when the return value is optimized away. Richard.