On Tue, Aug 12, 2014 at 6:40 PM, Felix Yang <fei.yang0...@gmail.com> wrote: > Hi Richard, > > I find that you missed the testcase with when committing the patch.
I don't think so. > GCC 4.8 & 4.9 branch also has the same issue, may be we need to > fix for them too? Yeah, I'll backport it. Thanks, Richard. > Cheers, > Felix > > > On Mon, Aug 11, 2014 at 7:24 PM, Richard Biener > <richard.guent...@gmail.com> wrote: >> On Sat, Aug 9, 2014 at 6:28 AM, Felix Yang <fei.yang0...@gmail.com> wrote: >>> Attached please find the patch and testcase for PR62037. >>> >>> DEF1 can be a GIMPLE_NOP and gimple_bb will be NULL then. The patch >>> checks for that. >>> Bootstrapped on x86_64-suse-linux. OK for trunk? Please commit this >>> patch if it's OK. >>> >> >> Thanks - applied. >> >> Richard. >> >>> Index: gcc/ChangeLog >>> =================================================================== >>> --- gcc/ChangeLog (revision 213772) >>> +++ gcc/ChangeLog (working copy) >>> @@ -1,3 +1,9 @@ >>> +2014-08-09 Felix Yang <fei.yang0...@gmail.com> >>> + >>> + PR tree-optimization/62073 >>> + * tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has >>> + a basic block. >>> + >>> 2014-08-08 Guozhi Wei <car...@google.com> >>> >>> * config/rs6000/rs6000.md (*movdi_internal64): Add a new constraint. >>> Index: gcc/testsuite/gcc.dg/vect/pr62073.c >>> =================================================================== >>> --- gcc/testsuite/gcc.dg/vect/pr62073.c (revision 0) >>> +++ gcc/testsuite/gcc.dg/vect/pr62073.c (revision 0) >>> @@ -0,0 +1,41 @@ >>> +/* { dg-do compile } */ >>> +/* { dg-options "-O1 -ftree-vectorize" } */ >>> + >>> +struct S0 >>> +{ >>> + int f7; >>> +}; >>> +struct S0 g_50; >>> +int g_70; >>> +int g_76; >>> + >>> + >>> +int foo (long long p_56, int * p_57) >>> +{ >>> + int *l_77; >>> + int l_101; >>> + >>> + for (; g_70;) >>> + { >>> + int **l_78 = &l_77; >>> + if (g_50.f7) >>> + continue; >>> + *l_78 = 0; >>> + } >>> + for (g_76 = 1; g_76 >= 0; g_76--) >>> + { >>> + int *l_90; >>> + for (l_101 = 4; l_101 >= 0; l_101--) >>> + if (l_101) >>> + *l_90 = 0; >>> + else >>> + { >>> + int **l_113 = &l_77; >>> + *l_113 = p_57; >>> + } >>> + } >>> + >>> + return *l_77; >>> +} >>> + >>> +/* { dg-final { cleanup-tree-dump "vect" } } */ >>> Index: gcc/testsuite/ChangeLog >>> =================================================================== >>> --- gcc/testsuite/ChangeLog (revision 213772) >>> +++ gcc/testsuite/ChangeLog (working copy) >>> @@ -1,3 +1,8 @@ >>> +2014-08-09 Felix Yang <fei.yang0...@gmail.com> >>> + >>> + PR tree-optimization/62073 >>> + * gcc.dg/vect/pr62073.c: New test. >>> + >>> 2014-08-08 Richard Biener <rguent...@suse.de> >>> >>> * gcc.dg/strlenopt-8.c: Remove XFAIL. >>> Index: gcc/tree-vect-loop.c >>> =================================================================== >>> --- gcc/tree-vect-loop.c (revision 213772) >>> +++ gcc/tree-vect-loop.c (working copy) >>> @@ -2321,7 +2321,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_inf >>> } >>> >>> def1 = SSA_NAME_DEF_STMT (op1); >>> - if (flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) >>> + if (gimple_bb (def1) >>> + && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) >>> && loop->inner >>> && flow_bb_inside_loop_p (loop->inner, gimple_bb (def1)) >>> && is_gimple_assign (def1)) >>> >>> >>> Cheers, >>> Felix