===================================================================
@@ -4951,8 +4951,32 @@
rtx
set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
{
- rtx note = find_reg_note (insn, kind, NULL_RTX);
+ rtx set, note;
+ enum machine_mode mode;
+ /* Sometimes the value is calculated with some SUBREG tricks, so the
+ SET_DEST of INSN ends up with a different mode then DATUM. */
+ set = single_set (insn);
+ if (set)
+ {
+ mode = GET_MODE (SET_DEST (set));
+ /* If DATUM is too narrow, we can't make it fit. */
+ if ((GET_MODE (datum) != VOIDmode || GET_MODE_CLASS (mode) != MODE_INT)
+ && GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (datum)))
+ return NULL_RTX;
+ if (GET_MODE (datum) != VOIDmode && GET_MODE (datum) != mode)
+ {
+ /* Adjust DATUM to the SET_DEST. */
+ datum = simplify_gen_subreg (mode, datum, GET_MODE (datum), 0);
+ if (!datum)
+ return NULL_RTX;
+ }
+ }
+ else /* Reload uses USEs with REG_EQUAL notes attached to keep track of
+ reload inhertiance opportunities. */
+ gcc_assert (PATTERN (insn) == USE && reload_in_progress);
+ note = find_reg_note (insn, kind, NULL_RTX);
+
switch (kind)
{
case REG_EQUAL: