This is a patch as proposed by paolo to fix a missing propagaton of const-int
addresses.
Bootstrapped and regression tested on i686-pc-linux-gnu.
Ok for trunk?
Johann
PR rtl-optimization/50448
* cprop.c (try_replace_reg): Try to simplify SET_SRC given the
substitution.
Index: cprop.c
===================================================================
--- cprop.c (revision 180654)
+++ cprop.c (working copy)
@@ -764,6 +764,18 @@ try_replace_reg (rtx from, rtx to, rtx i
note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
}
+ if (set && MEM_P (SET_DEST (set)) && reg_mentioned_p (from, SET_DEST (set)))
+ {
+ /* If above failed and this is a single set, try to simplify the source of
+ the set given our substitution. We could perhaps try this for multiple
+ SETs, but it probably won't buy us anything. */
+ rtx addr = simplify_replace_rtx (SET_DEST (set), from, to);
+
+ if (!rtx_equal_p (addr, SET_DEST (set))
+ && validate_change (insn, &SET_DEST (set), addr, 0))
+ success = 1;
+ }
+
/* REG_EQUAL may get simplified into register.
We don't allow that. Remove that note. This code ought
not to happen, because previous code ought to synthesize