public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH GCC][04/06]Add copying interface for dependence_info
@ 2017-08-14  9:32 Bin Cheng
  2017-08-25  4:25 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Cheng @ 2017-08-14  9:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

HI,
This patch adds copying interface for dependence_info.  The methodology
is we don't copy such information by default, and this interface should
be called explicitly when it is safe and necessary to do so.  Just like
this patch uses the interface in ivopts.
Bootstrap and test in series.  Is it OK?

Thanks,
bin
2017-08-10  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-address.c (copy_dependence_info): New function.
	* tree-ssa-address.h (copy_dependence_info): New declaration.
	* tree-ssa-loop-ivopts.c (rewrite_use_address): Call above func.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-copy-dep-fino-20170801.txt.patch --]
[-- Type: text/x-patch; name="0004-copy-dep-fino-20170801.txt.patch", Size: 2321 bytes --]

From 3cf0275d0db7d3e240bc7a010c6de68f15f46ce7 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Tue, 13 Jun 2017 15:57:24 +0100
Subject: [PATCH 4/6] copy-dep-fino-20170801.txt

---
 gcc/tree-ssa-address.c     | 17 +++++++++++++++++
 gcc/tree-ssa-address.h     |  1 +
 gcc/tree-ssa-loop-ivopts.c |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 8257fde..aea1730 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -958,6 +958,23 @@ get_address_description (tree op, struct mem_address *addr)
   addr->offset = TMR_OFFSET (op);
 }
 
+/* Copy data non-dependences info from FROM to TO which both are MEM_REF or
+   TARGET_MEM_REF.  */
+
+void
+copy_dependence_info (tree to, tree from)
+{
+  if ((TREE_CODE (from) != MEM_REF && TREE_CODE (from) != TARGET_MEM_REF)
+      || MR_DEPENDENCE_CLIQUE (from) == 0)
+    return;
+
+  gcc_assert (to != NULL_TREE);
+  gcc_assert (TREE_CODE (to) == MEM_REF || TREE_CODE (to) == TARGET_MEM_REF);
+  MR_DEPENDENCE_CLIQUE (to) = MR_DEPENDENCE_CLIQUE (from);
+  MR_DEPENDENCE_BASE (to) = MR_DEPENDENCE_BASE (from);
+  MR_DEPENDENCE_FIXED_LENGTH_P (to) = MR_DEPENDENCE_FIXED_LENGTH_P (from);
+}
+
 /* Copies the reference information from OLD_REF to NEW_REF, where
    NEW_REF should be either a MEM_REF or a TARGET_MEM_REF.  */
 
diff --git a/gcc/tree-ssa-address.h b/gcc/tree-ssa-address.h
index cd62ed9..ebba5ad 100644
--- a/gcc/tree-ssa-address.h
+++ b/gcc/tree-ssa-address.h
@@ -36,6 +36,7 @@ extern void move_fixed_address_to_symbol (struct mem_address *,
 					  struct aff_tree *);
 tree create_mem_ref (gimple_stmt_iterator *, tree,
 		     struct aff_tree *, tree, tree, tree, bool);
+extern void copy_dependence_info (tree, tree);
 extern void copy_ref_info (tree, tree);
 tree maybe_fold_tmr (tree);
 
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index b65cd96..6b1efc1 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -7023,6 +7023,9 @@ rewrite_use_address (struct ivopts_data *data,
 			     iv, base_hint, data->speed);
 
   copy_ref_info (ref, *use->op_p);
+  /* Copy dependece information from the original reference.  */
+  copy_dependence_info (ref, *use->op_p);
+
   *use->op_p = ref;
 }
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH GCC][04/06]Add copying interface for dependence_info
  2017-08-14  9:32 [PATCH GCC][04/06]Add copying interface for dependence_info Bin Cheng
@ 2017-08-25  4:25 ` Jeff Law
  2017-08-25 11:14   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2017-08-25  4:25 UTC (permalink / raw)
  To: Bin Cheng, gcc-patches; +Cc: nd

On 08/14/2017 03:19 AM, Bin Cheng wrote:
> HI,
> This patch adds copying interface for dependence_info.  The methodology
> is we don't copy such information by default, and this interface should
> be called explicitly when it is safe and necessary to do so.  Just like
> this patch uses the interface in ivopts.
> Bootstrap and test in series.  Is it OK?
> 
> Thanks,
> bin
> 2017-08-10  Bin Cheng  <bin.cheng@arm.com>
> 
> 	* tree-ssa-address.c (copy_dependence_info): New function.
> 	* tree-ssa-address.h (copy_dependence_info): New declaration.
> 	* tree-ssa-loop-ivopts.c (rewrite_use_address): Call above func.
So do we have any structure sharing assumptions on the alias structures?
 ie, are we setting up the possibility that these objects will be shared
and that someone will modify them in a way that works in one context,
but not another?

If they're readonly after creation, then obviously this isn't a concern.

I wouldn't consider this an object or an ACK for the patch at this
point. More a design question we need to answer.

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH GCC][04/06]Add copying interface for dependence_info
  2017-08-25  4:25 ` Jeff Law
@ 2017-08-25 11:14   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2017-08-25 11:14 UTC (permalink / raw)
  To: gcc-patches, Jeff Law, Bin Cheng, gcc-patches; +Cc: nd

On August 25, 2017 12:25:57 AM GMT+02:00, Jeff Law <law@redhat.com> wrote:
>On 08/14/2017 03:19 AM, Bin Cheng wrote:
>> HI,
>> This patch adds copying interface for dependence_info.  The
>methodology
>> is we don't copy such information by default, and this interface
>should
>> be called explicitly when it is safe and necessary to do so.  Just
>like
>> this patch uses the interface in ivopts.
>> Bootstrap and test in series.  Is it OK?
>> 
>> Thanks,
>> bin
>> 2017-08-10  Bin Cheng  <bin.cheng@arm.com>
>> 
>> 	* tree-ssa-address.c (copy_dependence_info): New function.
>> 	* tree-ssa-address.h (copy_dependence_info): New declaration.
>> 	* tree-ssa-loop-ivopts.c (rewrite_use_address): Call above func.
>So do we have any structure sharing assumptions on the alias
>structures?
>ie, are we setting up the possibility that these objects will be shared
>and that someone will modify them in a way that works in one context,
>but not another?
>
>If they're readonly after creation, then obviously this isn't a
>concern.
>
>I wouldn't consider this an object or an ACK for the patch at this
>point. More a design question we need to answer.

Note there are existing places where we copy the info. Note that for example the inliner re-maps the cliques during copying to not introduce false non-dependennces
This is another possibility to avoid the issue with unrolling. 

Richard. 

>Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-25  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14  9:32 [PATCH GCC][04/06]Add copying interface for dependence_info Bin Cheng
2017-08-25  4:25 ` Jeff Law
2017-08-25 11:14   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).