* [PATCH GCC][02/06]New field in struct dependence_info indicating fixed length access
@ 2017-08-14 10:31 Bin Cheng
2017-08-21 13:34 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Bin Cheng @ 2017-08-14 10:31 UTC (permalink / raw)
To: gcc-patches; +Cc: nd
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
Hi,
This simple patch adds new field in struct dependence_info. The new field
indicates if non-dependence information is only valid for fixed memory access
length of this reference. There is a concern that this costs an additional
byte for all tree nodes, but I do not know easy way out because we need to
differentiate dependence_info derived from runtime alias check with others
derived from restrict pointer.
Bootstrap and test in series. any comment?
Thanks,
bin
2017-08-10 Bin Cheng <bin.cheng@arm.com>
* tree-core.h (struct tree_base.dependence_info): New field.
* tree.c (copy_node): Reset dependence info for fixed length
memory access.
* tree.h (MR_DEPENDENCE_FIXED_LENGTH_P): New macro.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-fixed-length-dep-info-20170801.txt.patch --]
[-- Type: text/x-patch; name="0002-fixed-length-dep-info-20170801.txt.patch", Size: 2731 bytes --]
From 52073da1294a43723a5ee6a244c561f9b495f5b6 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Tue, 13 Jun 2017 15:56:42 +0100
Subject: [PATCH 2/6] fixed-length-dep-info-20170801.txt
---
gcc/tree-core.h | 10 ++++++++--
gcc/tree.c | 8 ++++++++
gcc/tree.h | 3 +++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 278d0c9..6200cb5 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -981,14 +981,20 @@ struct GTY(()) tree_base {
/* Internal function code. */
enum internal_fn ifn;
- /* The following two fields are used for MEM_REF and TARGET_MEM_REF
+ /* The first two fields are used for MEM_REF and TARGET_MEM_REF
expression trees and specify known data non-dependences. For
two memory references in a function they are known to not
alias if dependence_info.clique are equal and dependence_info.base
- are distinct. */
+ are distinct. The third field is used for marking that data
+ non-dependences info only holds within the fixed access length
+ of this reference. In other words, we should reset this info
+ whenever the MEM_REF and TARGET_MEM_REF are copied because we
+ don't know if it's used to build data reference accessing out-
+ side of fixed length. */
struct {
unsigned short clique;
unsigned short base;
+ bool fixed_length_p;
} dependence_info;
} GTY((skip(""))) u;
};
diff --git a/gcc/tree.c b/gcc/tree.c
index c493edd..9c4f248 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1211,6 +1211,14 @@ copy_node (tree node MEM_STAT_DECL)
memcpy (TREE_OPTIMIZATION (t), TREE_OPTIMIZATION (node),
sizeof (struct cl_optimization));
}
+ else if ((code == MEM_REF || code == TARGET_MEM_REF)
+ && MR_DEPENDENCE_FIXED_LENGTH_P (t))
+ {
+ /* Reset dependence information for copying. */
+ MR_DEPENDENCE_CLIQUE (t) = 0;
+ MR_DEPENDENCE_BASE (t) = 0;
+ MR_DEPENDENCE_FIXED_LENGTH_P (t) = false;
+ }
return t;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 46debc1..641b7ce 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1211,6 +1211,9 @@ extern void protected_set_expr_location (tree, location_t);
(TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.clique)
#define MR_DEPENDENCE_BASE(NODE) \
(TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.base)
+#define MR_DEPENDENCE_FIXED_LENGTH_P(NODE) \
+ (TREE_CHECK2 (NODE, MEM_REF, \
+ TARGET_MEM_REF)->base.u.dependence_info.fixed_length_p)
/* The operands of a BIND_EXPR. */
#define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0))
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH GCC][02/06]New field in struct dependence_info indicating fixed length access
2017-08-14 10:31 [PATCH GCC][02/06]New field in struct dependence_info indicating fixed length access Bin Cheng
@ 2017-08-21 13:34 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-08-21 13:34 UTC (permalink / raw)
To: Bin Cheng; +Cc: gcc-patches, nd
On Mon, Aug 14, 2017 at 11:19 AM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> This simple patch adds new field in struct dependence_info. The new field
> indicates if non-dependence information is only valid for fixed memory access
> length of this reference. There is a concern that this costs an additional
> byte for all tree nodes, but I do not know easy way out because we need to
> differentiate dependence_info derived from runtime alias check with others
> derived from restrict pointer.
> Bootstrap and test in series. any comment?
This increases each tree node by 8 bytes, so no. You'd have to carve the
bit away from either clique or base or find a bit elsewhere.
Note I do not understand the comment.
IIRC we discussed this in the context of versioning for aliasing where
for example vectorizer alias checks are performed with a min. dependence
distance in mind. So when marking refs as non-aliasing we have to ensure
the info still holds when unrolling the loop n > min. dependence distance time
which is ensured by clearing the non-alias info.
Basically the versioned loop copy now adheres to safelen = vect-factor and
the question is what safelen translates to (see also PR81877 for some fun
around safelen).
Richard.
> Thanks,
> bin
> 2017-08-10 Bin Cheng <bin.cheng@arm.com>
>
> * tree-core.h (struct tree_base.dependence_info): New field.
> * tree.c (copy_node): Reset dependence info for fixed length
> memory access.
> * tree.h (MR_DEPENDENCE_FIXED_LENGTH_P): New macro.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-21 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14 10:31 [PATCH GCC][02/06]New field in struct dependence_info indicating fixed length access Bin Cheng
2017-08-21 13:34 ` 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).