This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Fix PR tree-optimization/77654
- From: Doug Gilmore <Doug dot Gilmore at imgtec dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "rguenth at gcc dot gnu dot org" <rguenth at gcc dot gnu dot org>
- Date: Wed, 21 Sep 2016 22:09:42 +0000
- Subject: RE: [PATCH] Fix PR tree-optimization/77654
- Authentication-results: sourceware.org; auth=none
- References: <F007E4D1AE275F468C186A52E051529CE45644E1@BADAG02.ba.imgtec.org> <F007E4D1AE275F468C186A52E051529CE4564500@BADAG02.ba.imgtec.org>,<alpine.LSU.2.11.1609210943340.26629@t29.fhfr.qr>
> 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.
>
> ...
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