summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-21 11:52:50 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-21 11:52:50 +0000
commite7e444390f931238f09524973e93d4519ee231f1 (patch)
treef0a8757132cc149da091da8ed1fe7d71537f8744
parentee055341d8d291a33c4a5cf541d9f34c33a9cdfa (diff)
downloadlinaro-gcc-e7e444390f931238f09524973e93d4519ee231f1.tar.gz
linaro-gcc-e7e444390f931238f09524973e93d4519ee231f1.tar.bz2
linaro-gcc-e7e444390f931238f09524973e93d4519ee231f1.zip
2014-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/60577 * tree-core.h (struct tree_base): Document nothrow_flag use in VAR_DECL_NONALIASED. * tree.h (VAR_DECL_NONALIASED): New. (may_be_aliased): Adjust. * coverage.c (build_var): Set VAR_DECL_NONALIASED. * gcc.dg/tree-ssa/ssa-lim-11.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208746 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/coverage.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-11.c25
-rw-r--r--gcc/tree-core.h3
-rw-r--r--gcc/tree.h14
6 files changed, 53 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc03b1d6058..be0c8c48447 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2014-03-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60577
+ * tree-core.h (struct tree_base): Document nothrow_flag use
+ in VAR_DECL_NONALIASED.
+ * tree.h (VAR_DECL_NONALIASED): New.
+ (may_be_aliased): Adjust.
+ * coverage.c (build_var): Set VAR_DECL_NONALIASED.
+
2014-03-20 Eric Botcazou <ebotcazou@adacore.com>
* expr.c (expand_expr_real_1): Remove outdated comment.
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 8b62403d121..4c06fa47908 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -721,6 +721,7 @@ build_var (tree fn_decl, tree type, int counter)
DECL_NAME (var) = get_identifier (buf);
TREE_STATIC (var) = 1;
TREE_ADDRESSABLE (var) = 1;
+ DECL_NONALIASED (var) = 1;
DECL_ALIGN (var) = TYPE_ALIGN (type);
return var;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 611ccb4b0fd..aac3dc95c67 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60577
+ * gcc.dg/tree-ssa/ssa-lim-11.c: New testcase.
+
2014-03-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60599
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-11.c
new file mode 100644
index 00000000000..ea91a612376
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-11.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fprofile-arcs -fdump-tree-lim1-details" } */
+
+struct thread_param
+{
+ long* buf;
+ long iterations;
+ long accesses;
+} param;
+
+void access_buf(struct thread_param* p)
+{
+ long i,j;
+ long iterations = p->iterations;
+ long accesses = p->accesses;
+ for (i=0; i<iterations; i++)
+ {
+ long* pbuf = p->buf;
+ for (j=0; j<accesses; j++)
+ pbuf[j] += 1;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "Executing store motion of __gcov0.access_buf\\\[\[01\]\\\] from loop 1" 2 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index a2dc387d647..1719c7e664e 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -987,6 +987,9 @@ struct GTY(()) tree_base {
SSA_NAME_IN_FREELIST in
SSA_NAME
+ VAR_DECL_NONALIASED in
+ VAR_DECL
+
deprecated_flag:
TREE_DEPRECATED in
diff --git a/gcc/tree.h b/gcc/tree.h
index 71d68321a55..9fbc5c4ec2c 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2441,6 +2441,10 @@ extern void decl_fini_priority_insert (tree, priority_type);
#define DECL_NONLOCAL_FRAME(NODE) \
(VAR_DECL_CHECK (NODE)->base.default_def_flag)
+/* In a VAR_DECL, nonzero if this variable is not aliased by any pointer. */
+#define DECL_NONALIASED(NODE) \
+ (VAR_DECL_CHECK (NODE)->base.nothrow_flag)
+
/* This field is used to reference anything in decl.result and is meant only
for use by the garbage collector. */
#define DECL_RESULT_FLD(NODE) \
@@ -4462,12 +4466,14 @@ static inline bool
may_be_aliased (const_tree var)
{
return (TREE_CODE (var) != CONST_DECL
- && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
- && TREE_READONLY (var)
- && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
&& (TREE_PUBLIC (var)
|| DECL_EXTERNAL (var)
- || TREE_ADDRESSABLE (var)));
+ || TREE_ADDRESSABLE (var))
+ && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
+ && ((TREE_READONLY (var)
+ && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
+ || (TREE_CODE (var) == VAR_DECL
+ && DECL_NONALIASED (var)))));
}
/* Return pointer to optimization flags of FNDECL. */