This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix for PR62037
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Felix Yang <fei dot yang0953 at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "dorit at il dot ibm dot com" <dorit at il dot ibm dot com>, Ira Rosen <irar at il dot ibm dot com>
- Date: Wed, 13 Aug 2014 11:30:56 +0200
- Subject: Re: [PATCH] Fix for PR62037
- Authentication-results: sourceware.org; auth=none
- References: <CAFc0fxxRcDWbX0MZr2DXqOqaK4i=e5iP5KwtqvSndAB0tqO2fw at mail dot gmail dot com> <CAFiYyc2DJnesA_5BEHgjvufUyPx3b_KrweovincEzfRP6Zws=A at mail dot gmail dot com> <CAFc0fxzp5QrRp04CgUCWknHosQ8-O26VsO8vMKX8NBfGcTZfaw at mail dot gmail dot com>
On Tue, Aug 12, 2014 at 6:40 PM, Felix Yang <fei.yang0953@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.guenther@gmail.com> wrote:
>> On Sat, Aug 9, 2014 at 6:28 AM, Felix Yang <fei.yang0953@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.yang0953@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 <carrot@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.yang0953@gmail.com>
>>> +
>>> + PR tree-optimization/62073
>>> + * gcc.dg/vect/pr62073.c: New test.
>>> +
>>> 2014-08-08 Richard Biener <rguenther@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