===================================================================
@@ -6582,6 +6582,18 @@ curr_insn_location (void)
return curr_location;
}
+/* Set the location of the insn chain starting at INSN to LOC. */
+void
+set_insn_locations (rtx_insn *insn, location_t loc)
+{
+ while (insn)
+ {
+ if (INSN_P (insn))
+ INSN_LOCATION (insn) = loc;
+ insn = NEXT_INSN (insn);
+ }
+}
+
/* Return lexical scope block insn belongs to. */
tree
insn_scope (const rtx_insn *insn)
===================================================================
@@ -5244,19 +5244,6 @@ use_return_register (void)
diddle_return_value (do_use_return_reg, NULL);
}
-/* Set the location of the insn chain starting at INSN to LOC. */
-
-static void
-set_insn_locations (rtx_insn *insn, int loc)
-{
- while (insn != NULL)
- {
- if (INSN_P (insn))
- INSN_LOCATION (insn) = loc;
- insn = NEXT_INSN (insn);
- }
-}
-
/* Generate RTL for the end of the current function. */
void
===================================================================
@@ -1011,6 +1011,10 @@ emit_moves (void)
tmp = NEXT_INSN (tmp);
if (NOTE_INSN_BASIC_BLOCK_P (tmp))
tmp = NEXT_INSN (tmp);
+ /* Propagate the location of the current first instruction to the
+ moves so that they don't inherit a random location. */
+ if (tmp != NULL_RTX && INSN_P (tmp))
+ set_insn_locations (insns, INSN_LOCATION (tmp));
if (tmp == BB_HEAD (bb))
emit_insn_before (insns, tmp);
else if (tmp != NULL_RTX)
===================================================================
@@ -2929,6 +2929,7 @@ compensate_edge (edge e)
seq = get_insns ();
end_sequence ();
+ set_insn_locations (seq, e->goto_locus);
insert_insn_on_edge (seq, e);
return true;
}
===================================================================
@@ -4338,6 +4338,7 @@ extern void insn_locations_init (void);
extern void insn_locations_finalize (void);
extern void set_curr_insn_location (location_t);
extern location_t curr_insn_location (void);
+extern void set_insn_locations (rtx_insn *, location_t);
/* rtl-error.c */
extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)