This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR64240
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: "Yangfei (Felix)" <felix dot yang at huawei dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Dec 2014 15:57:36 +0100
- Subject: Re: [PATCH] Fix PR64240
- Authentication-results: sourceware.org; auth=none
- References: <DA41BE1DDCA941489001C7FBD7A8820E837AF45D at szxema507-mbx dot china dot huawei dot com> <5CFD0A4F-5062-4196-8E33-78CD22B8C205 at gmail dot com> <DA41BE1DDCA941489001C7FBD7A8820E837AF8E2 at szxema507-mbx dot china dot huawei dot com>
On Tue, Dec 16, 2014 at 11:41 AM, Yangfei (Felix) <felix.yang@huawei.com> wrote:
>> On December 16, 2014 9:51:25 AM CET, "Yangfei (Felix)" <felix.yang@huawei.com>
>> wrote:
>> >Hi,
>> >
>> >This patch fixes an obvious typo which may affect the DDG creation of
>> >SMS and make this optimization produce buggy code.
>> >Bootstrapped on x86_64-suse-linux. Also passed check-gcc test for
>> >aarch64-linux-gnu.
>> > OK for the trunk?
>>
>> Do you have a testcase? If so please add it.
>>
>> OK
>
> Yes, the patch is updated with the testcase added.
Ok.
Thanks,
Richard.
>
> Index: gcc/ddg.c
> ===================================================================
> --- gcc/ddg.c (revision 218582)
> +++ gcc/ddg.c (working copy)
> @@ -77,7 +77,7 @@ mark_mem_use (rtx *x, void *)
> {
> subrtx_iterator::array_type array;
> FOR_EACH_SUBRTX (iter, array, *x, NONCONST)
> - if (MEM_P (*x))
> + if (MEM_P (*iter))
> {
> mem_ref_p = true;
> break;
> Index: gcc/ChangeLog
> ===================================================================
> --- gcc/ChangeLog (revision 218582)
> +++ gcc/ChangeLog (working copy)
> @@ -1,3 +1,8 @@
> +2014-12-16 Felix Yang <felix.yang@huawei.com>
> +
> + PR rtl-optimization/64240
> + * ddg.c (mark_mem_use): Check *iter instead of *x.
> +
> 2014-12-10 Felix Yang <felix.yang@huawei.com>
>
> * config/aarch64/aarch64-protos.h (aarch64_function_profiler): Remove
> Index: gcc/testsuite/gcc.dg/sms-12.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/sms-12.c (revision 0)
> +++ gcc/testsuite/gcc.dg/sms-12.c (revision 0)
> @@ -0,0 +1,43 @@
> +/* { dg-do run } */
> +/* { dg-skip-if "" { ! { aarch64-*-* } } { "*" } { "" } } */
> +/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves -fPIC" } */
> +
> +extern void abort (void);
> +
> +int X[1000]={0};
> +int Y[1000]={0};
> +
> +extern void abort (void);
> +
> +__attribute__ ((noinline))
> +int
> +foo (int len, long a)
> +{
> + int i;
> + long res = a;
> +
> + len = 1000;
> + for (i = 0; i < len; i++)
> + res += X[i]* Y[i];
> +
> + if (res != 601)
> + abort ();
> +
> +}
> +
> +int
> +main ()
> +{
> + X[0] = Y[1] = 2;
> + Y[0] = X[1] = 21;
> + X[2] = Y[3] = 3;
> + Y[2] = X[3] = 31;
> + X[4] = Y[5] = 4;
> + Y[4] = X[5] = 41;
> +
> + foo (6, 3);
> + return 0;
> +}
> +
> +/* { dg-final { cleanup-rtl-dump "sms" } } */
> +
>
> Property changes on: gcc/testsuite/gcc.dg/sms-12.c
> ___________________________________________________________________
> Added: svn:executable
> + *
>
> Index: gcc/testsuite/ChangeLog
> ===================================================================
> --- gcc/testsuite/ChangeLog (revision 218582)
> +++ gcc/testsuite/ChangeLog (working copy)
> @@ -1,3 +1,8 @@
> +2014-12-16 Felix Yang <felix.yang@huawei.com>
> +
> + PR rtl-optimization/64240
> + * gcc.dg/sms-12.c: New test.
> +
> 2014-12-10 Martin Liska <mliska@suse.cz>
>
> * gcc.dg/ipa/pr63909.c: New test.