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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Valentyn Yukhymenko from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > This should be easy to add in forwprop or gimple fold.
> 
> Hey!
> 
> I found this issue via "GNU Tools Weekly" Mastodon post, which mentioned the
> possibility of mentorship.
> 
> I’d be happy to take a look at the issue, but would appreciate initial
> guidance since I am new to GCC project and so far only have some experience
> with C++ frontend.

See gimple_fold_builtin and gimple_fold_builtin_memory_op in gimple-fold.cc.
A simple way of implementing this would be if gimple_fold_builtin_memory_op
returns false in gimple_fold_builtin and the fcode is BUILT_IN_MEMPCPY, then
call a new function which do the replacement if gimple_call_lhs is NULL.

See gimple_fold_builtin_stpcpy for an example of replacement that is already
done.

Reply via email to