Do I always need to recognize the result?
validate_change and apply_change_group will take care of that.
If the answer is yes, than I suppose that if something bad happens,
the recognition will fail.
No, the problem is when recognition passes, and you have a SUBREG on the
LHS that will only modify part of the pseudo. I can't think off the top
of mind of a case, but I'd rather err on the side of safety.
It may still make sense changing the default case of
simplify_replace_rtx to invoke replace_rtx rather than returning x. But
this is unrelated, because nobody is currently passing a SET to
simplify_replace_rtx (only expressions), and you should do the same:
*you* said you want to replace on the RHS, so you really want to invoke
simplify_replace_rtx on the RHS.
Paolo