+2017-11-17 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * combine.c (added_notes_insn): New.
+ (try_combine): Handle added_notes_insn like added_links_insn.
+ Rewrite return value code.
+ (distribute_notes): Set added_notes_insn to the earliest insn we added
+ a note to.
+
2017-11-17 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/82621
static rtx_insn *added_links_insn;
+/* And similarly, for notes. */
+
+static rtx_insn *added_notes_insn;
+
/* Basic block in which we are performing combines. */
static basic_block this_basic_block;
static bool optimize_this_for_speed_p;
std::swap (i1, i2);
added_links_insn = 0;
+ added_notes_insn = 0;
/* First check for one important special case that the code below will
not handle. Namely, the case where I1 is zero, I2 is a PARALLEL
combine_successes++;
undo_commit ();
- if (added_links_insn
- && (newi2pat == 0 || DF_INSN_LUID (added_links_insn) < DF_INSN_LUID (i2))
- && DF_INSN_LUID (added_links_insn) < DF_INSN_LUID (i3))
- return added_links_insn;
- else
- return newi2pat ? i2 : i3;
+ rtx_insn *ret = newi2pat ? i2 : i3;
+ if (added_links_insn && DF_INSN_LUID (added_links_insn) < DF_INSN_LUID (ret))
+ ret = added_links_insn;
+ if (added_notes_insn && DF_INSN_LUID (added_notes_insn) < DF_INSN_LUID (ret))
+ ret = added_notes_insn;
+
+ return ret;
}
\f
/* Get a marker for undoing to the current state. */
{
XEXP (note, 1) = REG_NOTES (place);
REG_NOTES (place) = note;
+
+ /* Set added_notes_insn to the earliest insn we added a note to. */
+ if (added_notes_insn == 0
+ || DF_INSN_LUID (added_notes_insn) > DF_INSN_LUID (place))
+ added_notes_insn = place;
}
if (place2)
- add_shallow_copy_of_reg_note (place2, note);
+ {
+ add_shallow_copy_of_reg_note (place2, note);
+
+ /* Set added_notes_insn to the earliest insn we added a note to. */
+ if (added_notes_insn == 0
+ || DF_INSN_LUID (added_notes_insn) > DF_INSN_LUID (place2))
+ added_notes_insn = place2;
+ }
}
}
\f