1. Can you please give me an example of something bad that can happen to the LHS. Maybe I'm missing something here.

In this case nothing, but if NEW were a subreg, it can change a lot.

3. Isn't it reasonable to expect that every instance on old_rtx will be replaced by new_rtx even if it can't be simplified?
This is what I understand from the function's documentation.
But actually every expressions that can't be simplified is not replaced.

SET is not an expression, so it is not handled by simplify_replace_rtx.

I agree that it is confusing, that

  x = simplify_replace_rtx (a, b, c);

is different from

  x = simplify_rtx (replace_rtx (a, b, c));

So maybe all you need is changing the final "return x" to "return replace_rtx (x, old, new);". I reckon this change would be much cleaner than handling SET, but I would very much want to see what a GWP person thinks about this.

Paolo

Reply via email to