This approach seems reasonable. The current structure of the code
in simplify_replace_rtx is intended to handle RTL expressions rather
than patterns, so normally it would be passed just SET_SRC (pat),
instead of the whole set.
Which is why, OTOH, I would be *extremely* cautious doing such a
change. Leehod said:
> I tried to use simplify_replace_rtx to replace any use of (reg r) with[in]
> the right-hand-side of the extension and simplify the result.
If he want to replace uses within the RHS of the extension, he should
pass SET_SRC (pat). He may as well want to handle parallels, in which
case he should write a new function similar to this:
int i;
if (GET_CODE (pat) == SET)
SET_SRC (pat) = simplify_replace_rtx (SET_SRC (pat), old, new);
else if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (pat, 0); i++)
{
rtx s = XVECEXP (pat, 0, i);
if (GET_CODE (XVECEXP (pat, 0, i)) == SET)
SET_SRC (s) = simplify_replace_rtx (SET_SRC (s), old, new);
}
Paolo