RFA: redirect_jump_1: fix REG_EQUAL notes

Roger Sayle roger@eyesopen.com
Tue Mar 1 23:14:00 GMT 2005


On Tue, 1 Mar 2005, Joern RENNECKE wrote:
>       redirect_jump_2 (jump, olabel, nlabel, delete_unused, 1);
>       invert_br_probabilities (jump);
> ...
>       redirect_jump_2 (jump, old_dest, new_label, -1, reversep);
>       if (reversep)
>         invert_br_probabilities (jump);

Any reason not to move invert_br_probabilities into redirect_jump_2
as well, controlled by the "invert" parameter?


And I still disapprove of this idiom:

>  {
>!   redirect_exp_1 (&XEXP (note, 0), olabel, nlabel, jump);
>!   apply_change_group ();
>  }

Yes, the jump's PATTERN will probably have been cached by the previous
call to recog, but it remains needless overhead and poor example for
others to follow when contributing to GCC's RTL optimizers.  Its not
like this coding inefficiency can be avoided by improved compiler
optimization (at least not in our lifetimes :).  Instead, how about:

 XEXP (note, 0) = simplify_replace_rtx (XEXP (note, 0), olabel, nlabel);

Indeed this is the usual approach used in GCSE and CSE for updating
values/registers in REG_EQUAL notes.


I'll pre-approve a revised version of your latest patch with the above
two changes for mainline (after the usual bootstrap and regression test).

Roger
--



More information about the Gcc-patches mailing list