Index: gcc/reload1.c =================================================================== --- gcc/reload1.c (revision 115839) +++ gcc/reload1.c (working copy) @@ -4717,6 +4717,42 @@ reload_reg_reaches_end_p (unsigned int r } } +/* Returns 1 if the reloads denoted by R1 and R2 are uniquely chained + - the value of one is a component of the other, and that + intermediate is not used by any other reload for this insn. */ +static int +reloads_unique_chain (int r1, int r2) +{ + int i; + + /* We only check input reloads. */ + if (!rld[r1].in || !rld[r2].in) + return 0; + + /* Avoid anything with output reloads. */ + if (rld[r1].out || rld[r2].out) + return 0; + + /* "chained" means one reload is a component of the other reload, + not the same as the other reload. */ + if (rld[r1].opnum != rld[r2].opnum + || rtx_equal_p (rld[r1].in, rld[r2].in) + || rld[r1].optional || rld[r2].optional + || ! (reg_mentioned_p (rld[r1].in, rld[r2].in) + || reg_mentioned_p (rld[r2].in, rld[r1].in))) + return 0; + + for (i=0; i