On Mon, Oct 9, 2017 at 2:33 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Thu, Oct 5, 2017 at 3:16 PM, Bin Cheng <bin.ch...@arm.com> wrote: >> Hi, >> Function rename_variables_in_bb skips renaming PHI nodes in loop nest if the >> outer loop has only one inner loop. This breaks loop nest distribution when >> inner loop has PHI node initialized from outer loop's variable. >> Unfortunately, >> I lost the original C code illustrating the issue. Now it is only triggered >> in building spec2006/416.gamess with loop nest distribution, but I failed to >> reduce a test from it. > > Bah, can you re-try isolating a testcase? Hi Richard, Right, I managed a simple test with help of creduce. Given the simplicity of the test, I assume previous approval still holds for this updated patch and will apply it later.
Thanks, bin 2017-10-10 Bin Cheng <bin.ch...@arm.com> * tree-vect-loop-manip.c (rename_variables_in_bb): Rename PHI nodes when copying loop nest with only one inner loop. 2017-10-10 Bin Cheng <bin.ch...@arm.com> * gcc.dg/tree-ssa/ldist-34.c: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-34.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-34.c new file mode 100644 index 0000000..3d68a85 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-34.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribution" } */ + +#define X (3.0) +int b, c; +double a[30000]; +int foo () { + for (int i = 0; i < 100; ++i) { + for (int j = 0; j < c; ++j) + if (b) + a[0] = b; + a[i * 100] = a[1] = X; + } + return 0; +} diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 2c724a2..9fd65a7 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -117,8 +117,6 @@ rename_variables_in_bb (basic_block bb, bool rename_from_outer_loop) || single_pred (e->src) != outer_loop->header) continue; } - else - continue; } } for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);