diff mbox

Fix PR tree-optimization/77654

Message ID F007E4D1AE275F468C186A52E051529CE4564619@BADAG02.ba.imgtec.org
State New
Headers show

Commit Message

Doug Gilmore Sept. 21, 2016, 10:09 p.m. UTC
> From: Richard Biener [rguenther@suse.de]
> Sent: Wednesday, September 21, 2016 12:48 AM
> To: Doug Gilmore
> Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> Subject: RE: [PATCH] Fix PR tree-optimization/77654
> 
> On Tue, 20 Sep 2016, Doug Gilmore wrote:
> 
> > It looks like the original message was dropped, resending.
> >
> > Doug
> > ________________________________________
> > From: Doug Gilmore
> > Sent: Tuesday, September 20, 2016 2:12 PM
> > To: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> > Subject: [PATCH] Fix PR tree-optimization/77654
> >
> > From:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77654
> >
> > Richard Biener wrote:
> > > Looks good though addr_base should always be a pointer but it might
> > > not be an SSA name so better check that...
> >
> > I took a look at other situations where duplicate_ssa_name_ptr_info()
> > is called and found that there are no checks for the SSA name since
> > that check is done in duplicate_ssa_name_ptr_info().  Do you still
> > want the additional check added?
> 
> It checks for !ptr_info but it requires NAME to be an SSA name.
> 
> From the attachment in bugzilla (the attachment didn't make it
> here)
> 
> 
> +
> +      if (POINTER_TYPE_P (TREE_TYPE (addr_base)))
> +       {
> +         duplicate_ssa_name_ptr_info (addr, SSA_NAME_PTR_INFO (addr_base));
> +         /* As this isn't a plain copy we have to reset alignment
> +            information.  */
> +         if (SSA_NAME_PTR_INFO (addr))
> +           mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr));
> +       }
> +
> 
> I was talking about changing the if to
> 
>     if (TREE_CODE (addr_base) == SSA_NAME
>         && TREE_CODE (addr) == SSA_NAME)
Sorry I that missed point.  I glossed your comment "addr_base should
always be a pointer", causing me to go off into the weeds.

New patch attached.

Thanks,

Doug
> 
> because the addresses could be invariant as far as I can see.
> 
> > Also does it make sense to make a test case for this?
> 
> I'm not sure how to easily test this.
> 
> Richard.
> 
> ...

Comments

Richard Biener Sept. 22, 2016, 7:43 a.m. UTC | #1
On Wed, 21 Sep 2016, Doug Gilmore wrote:

> > From: Richard Biener [rguenther@suse.de]
> > Sent: Wednesday, September 21, 2016 12:48 AM
> > To: Doug Gilmore
> > Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> > Subject: RE: [PATCH] Fix PR tree-optimization/77654
> > 
> > On Tue, 20 Sep 2016, Doug Gilmore wrote:
> > 
> > > It looks like the original message was dropped, resending.
> > >
> > > Doug
> > > ________________________________________
> > > From: Doug Gilmore
> > > Sent: Tuesday, September 20, 2016 2:12 PM
> > > To: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> > > Subject: [PATCH] Fix PR tree-optimization/77654
> > >
> > > From:
> > >
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77654
> > >
> > > Richard Biener wrote:
> > > > Looks good though addr_base should always be a pointer but it might
> > > > not be an SSA name so better check that...
> > >
> > > I took a look at other situations where duplicate_ssa_name_ptr_info()
> > > is called and found that there are no checks for the SSA name since
> > > that check is done in duplicate_ssa_name_ptr_info().  Do you still
> > > want the additional check added?
> > 
> > It checks for !ptr_info but it requires NAME to be an SSA name.
> > 
> > From the attachment in bugzilla (the attachment didn't make it
> > here)
> > 
> > 
> > +
> > +      if (POINTER_TYPE_P (TREE_TYPE (addr_base)))
> > +       {
> > +         duplicate_ssa_name_ptr_info (addr, SSA_NAME_PTR_INFO (addr_base));
> > +         /* As this isn't a plain copy we have to reset alignment
> > +            information.  */
> > +         if (SSA_NAME_PTR_INFO (addr))
> > +           mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr));
> > +       }
> > +
> > 
> > I was talking about changing the if to
> > 
> >     if (TREE_CODE (addr_base) == SSA_NAME
> >         && TREE_CODE (addr) == SSA_NAME)
> Sorry I that missed point.  I glossed your comment "addr_base should
> always be a pointer", causing me to go off into the weeds.
> 
> New patch attached.

Ok if successfully bootstrapped / tested.

Thanks,
Richard.

> Thanks,
> 
> Doug
> > 
> > because the addresses could be invariant as far as I can see.
> > 
> > > Also does it make sense to make a test case for this?
> > 
> > I'm not sure how to easily test this.
> > 
> > Richard.
> > 
> > ...
>
Doug Gilmore Sept. 22, 2016, 10:15 p.m. UTC | #2
> From: Richard Biener [rguenther@suse.de]
> Sent: Thursday, September 22, 2016 12:43 AM
> To: Doug Gilmore
> Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> Subject: RE: [PATCH] Fix PR tree-optimization/77654
> 
> On Wed, 21 Sep 2016, Doug Gilmore wrote:
> 
> ...
> > Sorry I that missed point.  I glossed your comment "addr_base should
> > always be a pointer", causing me to go off into the weeds.
> >
> > New patch attached.
> 
> Ok if successfully bootstrapped / tested.
> 
> Thanks,
> Richard.
The change bootstrapped on X86_64 and the several "make check" errors
also appeared in latest archived mail message to gcc-testresults.

Thanks,
Doug
> 
> > ...
Matthew Fortune Sept. 23, 2016, 3:55 p.m. UTC | #3
Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
> > From: Richard Biener [rguenther@suse.de]
> > Sent: Thursday, September 22, 2016 12:43 AM
> > To: Doug Gilmore
> > Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> > Subject: RE: [PATCH] Fix PR tree-optimization/77654
> >
> > On Wed, 21 Sep 2016, Doug Gilmore wrote:
> >
> > ...
> > > Sorry I that missed point.  I glossed your comment "addr_base should
> > > always be a pointer", causing me to go off into the weeds.
> > >
> > > New patch attached.
> >
> > Ok if successfully bootstrapped / tested.
> >
> > Thanks,
> > Richard.
> The change bootstrapped on X86_64 and the several "make check" errors
> also appeared in latest archived mail message to gcc-testresults.

Committed as r240439.

(Fixed whitespace/tab issue in the code and incorrect file in changelog)

I can't progress the bug status. Who does that normally?

Matthew
Mike Stump Sept. 23, 2016, 4:17 p.m. UTC | #4
On Sep 23, 2016, at 8:55 AM, Matthew Fortune <Matthew.Fortune@imgtec.com> wrote:
> 
> Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
>>> From: Richard Biener [rguenther@suse.de]
>>> Sent: Thursday, September 22, 2016 12:43 AM
>>> To: Doug Gilmore
>>> Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
>>> Subject: RE: [PATCH] Fix PR tree-optimization/77654
>>> 
>>> On Wed, 21 Sep 2016, Doug Gilmore wrote:
>>> 
>>> ...
>>>> Sorry I that missed point.  I glossed your comment "addr_base should
>>>> always be a pointer", causing me to go off into the weeds.
>>>> 
>>>> New patch attached.
>>> 
>>> Ok if successfully bootstrapped / tested.
>>> 
>>> Thanks,
>>> Richard.
>> The change bootstrapped on X86_64 and the several "make check" errors
>> also appeared in latest archived mail message to gcc-testresults.
> 
> Committed as r240439.
> 
> (Fixed whitespace/tab issue in the code and incorrect file in changelog)
> 
> I can't progress the bug status. Who does that normally?

Hum..  not sure why, I thought commit people could do bug database bits.  Maybe someone will chime in on this topic for you.

Anyway, anyone can move the bug along, just let us know what state change you want.  I've assumed Fixed. was the state change you were interested in.  I've done that.
Richard Biener Sept. 23, 2016, 6:04 p.m. UTC | #5
On September 23, 2016 6:17:17 PM GMT+02:00, Mike Stump <mikestump@comcast.net> wrote:
>On Sep 23, 2016, at 8:55 AM, Matthew Fortune
><Matthew.Fortune@imgtec.com> wrote:
>> 
>> Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
>>>> From: Richard Biener [rguenther@suse.de]
>>>> Sent: Thursday, September 22, 2016 12:43 AM
>>>> To: Doug Gilmore
>>>> Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
>>>> Subject: RE: [PATCH] Fix PR tree-optimization/77654
>>>> 
>>>> On Wed, 21 Sep 2016, Doug Gilmore wrote:
>>>> 
>>>> ...
>>>>> Sorry I that missed point.  I glossed your comment "addr_base
>should
>>>>> always be a pointer", causing me to go off into the weeds.
>>>>> 
>>>>> New patch attached.
>>>> 
>>>> Ok if successfully bootstrapped / tested.
>>>> 
>>>> Thanks,
>>>> Richard.
>>> The change bootstrapped on X86_64 and the several "make check"
>errors
>>> also appeared in latest archived mail message to gcc-testresults.
>> 
>> Committed as r240439.
>> 
>> (Fixed whitespace/tab issue in the code and incorrect file in
>changelog)
>> 
>> I can't progress the bug status. Who does that normally?
>
>Hum..  not sure why, I thought commit people could do bug database
>bits.  Maybe someone will chime in on this topic for you.

You need to use a bugzilla account with your @gcc.gnu.org address.  Those have appropriate permissions.

Richard.

>Anyway, anyone can move the bug along, just let us know what state
>change you want.  I've assumed Fixed. was the state change you were
>interested in.  I've done that.
Christophe Lyon Sept. 29, 2016, 7:17 p.m. UTC | #6
On 23 September 2016 at 17:55, Matthew Fortune
<Matthew.Fortune@imgtec.com> wrote:
> Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
>> > From: Richard Biener [rguenther@suse.de]
>> > Sent: Thursday, September 22, 2016 12:43 AM
>> > To: Doug Gilmore
>> > Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
>> > Subject: RE: [PATCH] Fix PR tree-optimization/77654
>> >
>> > On Wed, 21 Sep 2016, Doug Gilmore wrote:
>> >
>> > ...
>> > > Sorry I that missed point.  I glossed your comment "addr_base should
>> > > always be a pointer", causing me to go off into the weeds.
>> > >
>> > > New patch attached.
>> >
>> > Ok if successfully bootstrapped / tested.
>> >
>> > Thanks,
>> > Richard.
>> The change bootstrapped on X86_64 and the several "make check" errors
>> also appeared in latest archived mail message to gcc-testresults.
>
> Committed as r240439.
>

Since this commit, I've noticed ICE on arm target:
FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
(internal compiler error)
FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
(test for excess errors)
Excess errors:
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/params/blocksort-part.c:116:6:
internal compiler error: in duplicate
_ssa_name_ptr_info, at tree-ssanames.c:630
0xd5a972 duplicate_ssa_name_ptr_info(tree_node*, ptr_info_def*)
        /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssanames.c:630
0xcac0e0 issue_prefetch_ref
        /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1168
0xcad89f issue_prefetches
        /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1195
0xcad89f loop_prefetch_arrays
        /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1928
0xcae722 tree_ssa_prefetch_arrays()
        /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1992


--target arm-none-linux-gnueabihf --with-cpu=cortex-a9
--wihth-fpu=neon-fp16 --with-mode=arm

I'm not sure the cpu/fpu/mode settings are mandatory but at least in this case
the compiler ICEs.

Christophe


> (Fixed whitespace/tab issue in the code and incorrect file in changelog)
>
> I can't progress the bug status. Who does that normally?
>
> Matthew
Doug Gilmore Sept. 29, 2016, 10:04 p.m. UTC | #7
> From: Christophe Lyon [christophe.lyon@linaro.org]
> Sent: Thursday, September 29, 2016 12:17 PM
> To: Matthew Fortune
> Cc: Doug Gilmore; Richard Biener; gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> Subject: Re: [PATCH] Fix PR tree-optimization/77654
> ...
> 
> Since this commit, I've noticed ICE on arm target:
> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
> (internal compiler error)
> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
> (test for excess errors)
> Excess errors:
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/params/blocksort-part.c:116:6:
> internal compiler error: in duplicate
> _ssa_name_ptr_info, at tree-ssanames.c:630
> 0xd5a972 duplicate_ssa_name_ptr_info(tree_node*, ptr_info_def*)
>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssanames.c:630
> 0xcac0e0 issue_prefetch_ref
>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1168
> 0xcad89f issue_prefetches
>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1195
> 0xcad89f loop_prefetch_arrays
>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1928
> 0xcae722 tree_ssa_prefetch_arrays()
>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-ssa-loop-prefetch.c:1992
> 
> 
> --target arm-none-linux-gnueabihf --with-cpu=cortex-a9
> --wihth-fpu=neon-fp16 --with-mode=arm
> 
> I'm not sure the cpu/fpu/mode settings are mandatory but at least in this case
> the compiler ICEs.
> 
> Christophe
I'll look into this.

Doug
> 
> 
> > (Fixed whitespace/tab issue in the code and incorrect file in changelog)
> >
> > I can't progress the bug status. Who does that normally?
> >
> > Matthew
Doug Gilmore Sept. 30, 2016, 6:10 p.m. UTC | #8
> From: Christophe Lyon [christophe.lyon@linaro.org]
> Sent: Thursday, September 29, 2016 12:17 PM
> To: Matthew Fortune
> Cc: Doug Gilmore; Richard Biener; gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> Subject: Re: [PATCH] Fix PR tree-optimization/77654
> 
> On 23 September 2016 at 17:55, Matthew Fortune
> <Matthew.Fortune@imgtec.com> wrote:
> > Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
> >> > From: Richard Biener [rguenther@suse.de]
> >> > Sent: Thursday, September 22, 2016 12:43 AM
> >> > To: Doug Gilmore
> >> > Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
> >> > Subject: RE: [PATCH] Fix PR tree-optimization/77654
> >> >
> >> > On Wed, 21 Sep 2016, Doug Gilmore wrote:
> >> >
> >> > ...
> >> > > Sorry I that missed point.  I glossed your comment "addr_base should
> >> > > always be a pointer", causing me to go off into the weeds.
> >> > >
> >> > > New patch attached.
> >> >
> >> > Ok if successfully bootstrapped / tested.
> >> >
> >> > Thanks,
> >> > Richard.
> >> The change bootstrapped on X86_64 and the several "make check" errors
> >> also appeared in latest archived mail message to gcc-testresults.
> >
> > Committed as r240439.
> >
> 
> Since this commit, I've noticed ICE on arm target:
> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
> (internal compiler error)
> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
> (test for excess errors)
> Excess errors:
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/params/blocksort-part.c:116:6:
> internal compiler error: in duplicate
> _ssa_name_ptr_info, at tree-ssanames.c:630
> ...
Hi Christophe,

I filed PR77808, will send out a fix shortly.

BTW, I missed this in regression testing since -fprefetch-loop-arrays
is needed to expose the problem.  Are you setting this as the default
in your compiler build?

Thanks,

Doug
Christophe Lyon Sept. 30, 2016, 6:25 p.m. UTC | #9
On 30 September 2016 at 20:10, Doug Gilmore <Doug.Gilmore@imgtec.com> wrote:
>> From: Christophe Lyon [christophe.lyon@linaro.org]
>> Sent: Thursday, September 29, 2016 12:17 PM
>> To: Matthew Fortune
>> Cc: Doug Gilmore; Richard Biener; gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
>> Subject: Re: [PATCH] Fix PR tree-optimization/77654
>>
>> On 23 September 2016 at 17:55, Matthew Fortune
>> <Matthew.Fortune@imgtec.com> wrote:
>> > Doug Gilmore <Doug.Gilmore@imgtec.com> writes:
>> >> > From: Richard Biener [rguenther@suse.de]
>> >> > Sent: Thursday, September 22, 2016 12:43 AM
>> >> > To: Doug Gilmore
>> >> > Cc: gcc-patches@gcc.gnu.org; rguenth@gcc.gnu.org
>> >> > Subject: RE: [PATCH] Fix PR tree-optimization/77654
>> >> >
>> >> > On Wed, 21 Sep 2016, Doug Gilmore wrote:
>> >> >
>> >> > ...
>> >> > > Sorry I that missed point.  I glossed your comment "addr_base should
>> >> > > always be a pointer", causing me to go off into the weeds.
>> >> > >
>> >> > > New patch attached.
>> >> >
>> >> > Ok if successfully bootstrapped / tested.
>> >> >
>> >> > Thanks,
>> >> > Richard.
>> >> The change bootstrapped on X86_64 and the several "make check" errors
>> >> also appeared in latest archived mail message to gcc-testresults.
>> >
>> > Committed as r240439.
>> >
>>
>> Since this commit, I've noticed ICE on arm target:
>> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
>> (internal compiler error)
>> FAIL: gcc.dg/params/blocksort-part.c -O3 --param prefetch-latency=0
>> (test for excess errors)
>> Excess errors:
>> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dREMOTE_SNAPSHOTS=g/params/blocksort-part.c:116:6:
>> internal compiler error: in duplicate
>> _ssa_name_ptr_info, at tree-ssanames.c:630
>> ...
> Hi Christophe,
>
> I filed PR77808, will send out a fix shortly.
>
Thanks

> BTW, I missed this in regression testing since -fprefetch-loop-arrays
> is needed to expose the problem.  Are you setting this as the default
> in your compiler build?
>
No, I did not do anything special.
I'm not sure to understand: this option is not in the command line
of the offending test.

Christophe

> Thanks,
>
> Doug
diff mbox

Patch

From 2d6cb0674ca66b4c5f6e335d73122e03413863e3 Mon Sep 17 00:00:00 2001
From: Doug Gilmore <doug.gilmore@imgtec.com>
Date: Tue, 6 Sep 2016 10:18:42 -0700
Subject: [PATCH] Ensure points-to information is maintained for prefetch.

gcc/
        PR tree-optimization/77654
        * tree-ssa-alias.c (issue_prefetch_ref): Add call
        to duplicate_ssa_name_ptr_info.
---
 gcc/tree-ssa-loop-prefetch.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 26cf0a0..d0bd2d3 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -39,6 +39,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-loop-manip.h"
 #include "tree-ssa-loop-niter.h"
 #include "tree-ssa-loop.h"
+#include "ssa.h"
 #include "tree-into-ssa.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
@@ -1160,6 +1161,17 @@  issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
           addr = force_gimple_operand_gsi (&bsi, unshare_expr (addr), true,
 					   NULL, true, GSI_SAME_STMT);
       }
+
+      if (TREE_CODE (addr_base) == SSA_NAME
+          && TREE_CODE (addr) == SSA_NAME)
+	{
+	  duplicate_ssa_name_ptr_info (addr, SSA_NAME_PTR_INFO (addr_base));
+	  /* As this isn't a plain copy we have to reset alignment
+	     information.  */
+	  if (SSA_NAME_PTR_INFO (addr))
+	    mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr));
+	}
+
       /* Create the prefetch instruction.  */
       prefetch = gimple_build_call (builtin_decl_explicit (BUILT_IN_PREFETCH),
 				    3, addr, write_p, local);
-- 
1.7.9.5