@@ -2011,6 +2011,11 @@ update_range_test (struct range_entry *r
gsi = gsi_for_stmt (stmt);
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true,
GSI_SAME_STMT);
+ for (gsi_prev (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi))
+ if (gimple_uid (gsi_stmt (gsi)))
+ break;
+ else
+ gimple_set_uid (gsi_stmt (gsi), gimple_uid (stmt));
/* If doing inter-bb range test optimization, update the
stmts immediately. Start with changing the first range test
@@ -0,0 +1,26 @@
+/* PR tree-optimization/58775 */
+
+void bar (void);
+
+void
+foo (char *x)
+{
+ char a;
+ _Bool b, c, d, e, f, g, h, i, j, k, l, m;
+
+ a = *x;
+ b = a == 100;
+ c = a == 105;
+ d = b | c;
+ e = a != 111;
+ f = !d;
+ g = e & f;
+ h = a != 117;
+ i = g & h;
+ j = a != 120;
+ k = i & j;
+ l = a != 88;
+ m = k & l;
+ if (m == 0)
+ bar ();
+}