order_nodes are used to implement ordered comparisons between
two insns with the same program point number. remove_insn would
remove an order_node from its splay tree, but didn't remove it
from the insn. This caused confusion if the insn was later
reinserted somewhere else that also needed an order_node.
gcc/
PR rtl-optimization/115929
* rtl-ssa/insns.cc (function_info::remove_insn): Remove an
order_node from the instruction as well as from the splay tree.
gcc/testsuite/
PR rtl-optimization/115929
* gcc.dg/torture/pr115929-1.c: New test.
function_info::remove_insn (insn_info *insn)
{
if (insn_info::order_node *order = insn->get_order_node ())
- insn_info::order_splay_tree::remove_node (order);
+ {
+ insn_info::order_splay_tree::remove_node (order);
+ insn->remove_note (order);
+ }
if (auto *note = insn->find_note<insn_call_clobbers_note> ())
{
--- /dev/null
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-fno-gcse -fschedule-insns -fno-guess-branch-probability -fno-tree-fre -fno-tree-ch" } */
+
+int printf(const char *, ...);
+int a[6], b, c;
+char d, l;
+struct {
+ char e;
+ int f;
+ int : 8;
+ long g;
+ long h;
+} i[1][9] = {0};
+unsigned j;
+void n(char p) { b = b >> 8 ^ a[b ^ p]; }
+int main() {
+ int k, o;
+ while (b) {
+ k = 0;
+ for (; k < 9; k++) {
+ b = b ^ a[l];
+ n(j);
+ if (o)
+ printf(&d);
+ long m = i[c][k].f;
+ b = b >> 8 ^ a[l];
+ n(m >> 32);
+ n(m);
+ if (o)
+ printf("%d", d);
+ b = b >> 8 ^ l;
+ n(2);
+ n(0);
+ if (o)
+ printf(&d);
+ b = b ^ a[l];
+ n(i[c][k].g >> 2);
+ n(i[c][k].g);
+ if (o)
+ printf(&d);
+ printf("%d", i[c][k].f);
+ }
+ }
+ return 0;
+}