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.ch...@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.
From 52073da1294a43723a5ee6a244c561f9b495f5b6 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binch...@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