> while working on the GCN port I ended up with many redundant register copies
> of the form
>  mov reg, exec
>  do something
>  mov reg, exec
>  do something
>  ...
> these copies are generated by LRA because exec is small register class and
> needs a lot of reloading (it could be improved too, but I do not care
> because I want to handle exec specially later anyway).
> I was however suprised this garbage survives postreload optimizations.  It
> is easy to fix in regcprop which already does some noop copy elimination,
> but only of the for mov reg, reg after substituting.

Right, this ought to be dealt with during postreload CSE, there is roughly the 
same code as yours:

/* See whether a single set SET is a noop.  */
static int
reload_cse_noop_set_p (rtx set)
  if (cselib_reg_set_mode (SET_DEST (set)) != GET_MODE (SET_DEST (set)))
    return 0;

  return rtx_equal_for_cselib_p (SET_DEST (set), SET_SRC (set));

Any idea about why this doesn't work in your case?

Eric Botcazou

Reply via email to