+2010-10-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/45849
+ * var-tracking.c (strip_pointer_flags): New function.
+ (emit_note_insn_var_location): If rtx_equal_p check failed,
+ retry on locations simplified with simplify_replace_fn_rtx
+ and strip_pointer_flags as its callback.
+
2010-10-04 Jan Hubicka <jh@suse.cz>
* gimple-fold.c (static_object_in_other_unit_p): Rename to...
#ifdef ENABLE_RTL_CHECKING
/* Used to verify that cur_loc_changed updating is safe. */
static struct pointer_map_t *emitted_notes;
+
+/* Strip REG_POINTER from REGs and MEM_POINTER from MEMs in order to
+ avoid differences in commutative operand simplification. */
+static rtx
+strip_pointer_flags (rtx x, const_rtx old_rtx ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ if (REG_P (x) && REG_POINTER (x))
+ return gen_rtx_REG (GET_MODE (x), REGNO (x));
+ if (MEM_P (x) && MEM_POINTER (x))
+ return gen_rtx_MEM (GET_MODE (x), XEXP (x, 0));
+ return NULL_RTX;
+}
#endif
/* Emit the NOTE_INSN_VAR_LOCATION for variable *VARP. DATA contains
rtx pnote = (rtx) *note_slot;
if (!var->cur_loc_changed && (pnote || PAT_VAR_LOCATION_LOC (note_vl)))
{
+ rtx old_vl, new_vl;
gcc_assert (pnote);
- gcc_assert (rtx_equal_p (PAT_VAR_LOCATION_LOC (pnote),
- PAT_VAR_LOCATION_LOC (note_vl)));
+ old_vl = PAT_VAR_LOCATION_LOC (pnote);
+ new_vl = PAT_VAR_LOCATION_LOC (note_vl);
+ if (!rtx_equal_p (old_vl, new_vl))
+ {
+ /* There might be differences caused by REG_POINTER
+ differences. REG_POINTER affects
+ swap_commutative_operands_p. */
+ old_vl = simplify_replace_fn_rtx (old_vl, NULL_RTX,
+ strip_pointer_flags, NULL);
+ new_vl = simplify_replace_fn_rtx (new_vl, NULL_RTX,
+ strip_pointer_flags, NULL);
+ gcc_assert (rtx_equal_p (old_vl, new_vl));
+ PAT_VAR_LOCATION_LOC (note_vl) = new_vl;
+ }
}
*note_slot = (void *) note_vl;
}