Commit 6fb8055e by Andrey Belevantsev Committed by Alexander Monakov

sel-sched: skip outer loop in get_all_loop_exits (PR 84206)

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.

	* gcc.dg/pr84206.c: New test.

From-SVN: r270096
parent 7dc69ec0
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
* sel-sched.c (code_motion_path_driver): Avoid unwinding first_insn
beyond the original fence.
......
......@@ -1144,6 +1144,7 @@ get_all_loop_exits (basic_block bb)
struct loop *this_loop;
struct loop *pred_loop = NULL;
int i;
unsigned this_depth;
edge e;
for (this_loop = bb->loop_father;
......@@ -1155,11 +1156,14 @@ get_all_loop_exits (basic_block bb)
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
* gcc.dg/pr85876.c: New test.
......
/* { 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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment