+2019-04-02 Andrey Belevantsev <abel@ispras.ru>
+
+ PR rtl-optimization/84206
+ * sel-sched-ir.h (get_all_loop_exits): Avoid the outer loop when
+ iterating over loop headers.
+
2019-04-02 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/85876
struct loop *this_loop;
struct loop *pred_loop = NULL;
int i;
+ unsigned this_depth;
edge e;
for (this_loop = bb->loop_father;
gcc_assert (this_loop != NULL);
exits = get_loop_exit_edges_unique_dests (this_loop);
+ this_depth = loop_depth (this_loop);
- /* Traverse all loop headers. */
+ /* Traverse all loop headers. Be careful not to go back
+ to the outer loop's header (see PR 84206). */
for (i = 0; exits.iterate (i, &e); i++)
- if (in_current_region_p (e->dest)
- || inner_loop_header_p (e->dest))
+ if ((in_current_region_p (e->dest)
+ || (inner_loop_header_p (e->dest)))
+ && loop_depth (e->dest->loop_father) >= this_depth)
{
vec<edge> next_exits = get_all_loop_exits (e->dest);
+2019-04-02 Andrey Belevantsev <abel@ispras.ru>
+
+ PR rtl-optimization/84206
+ * gcc.dg/pr84206.c: New test.
+
2019-04-02 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/85876
--- /dev/null
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fselective-scheduling -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-forward-propagate -fno-tree-fre -w" } */
+
+long long unsigned int ao;
+int hk;
+
+void
+b8 (void)
+{
+ int *w9;
+
+ c8:
+ ao = 0;
+ w9 = &ao;
+ for (;;)
+ for (hk = 0; hk < 1; ++hk)
+ for (ao = 0; ao < 4; ++ao)
+ {
+ int f4 = (ao != 0) ? *w9 : hk;
+
+ if (f4 != 0)
+ goto c8;
+ }
+}