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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 40933
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40933&action=edit
gcc7-pr79909.patch

This looks like a combiner bug to me.  replace_rtx is documented not to copy
anything, so if there is more than one occurrence of i2dest, i1dest or i0dest,
then we'll end up with RTL sharing.  What could be done is reset_used_flags on
i2src, i1src and i0src (if it is not used somewhere else) or set_used_flags
(otherwise) and copy_rtx_if_shared on the whole call_fusage at the end.
I believe copying the whole fusage ahead is unnecessary (we are not planning to
undo it at this point) and it should not be shared with anything else.  On the
other side we need to copy if we replace something.  Plus it creates (plus
(plus something (const_int N1)) (const_int N2)) and similar, so I think
simplify_replace_rtx is better for that.

Reply via email to