re PR tree-optimization/60577 (inefficient FDO instrumentation code)

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.

From-SVN: r208746
This commit is contained in:
Richard Biener 2014-03-21 11:52:50 +00:00 committed by Richard Biener
parent beeda1d9c4
commit 400a4f6ca2
6 changed files with 53 additions and 4 deletions

View File

@ -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> 2014-03-20 Eric Botcazou <ebotcazou@adacore.com>
* expr.c (expand_expr_real_1): Remove outdated comment. * expr.c (expand_expr_real_1): Remove outdated comment.

View File

@ -721,6 +721,7 @@ build_var (tree fn_decl, tree type, int counter)
DECL_NAME (var) = get_identifier (buf); DECL_NAME (var) = get_identifier (buf);
TREE_STATIC (var) = 1; TREE_STATIC (var) = 1;
TREE_ADDRESSABLE (var) = 1; TREE_ADDRESSABLE (var) = 1;
DECL_NONALIASED (var) = 1;
DECL_ALIGN (var) = TYPE_ALIGN (type); DECL_ALIGN (var) = TYPE_ALIGN (type);
return var; return var;

View File

@ -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> 2014-03-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60599 PR fortran/60599

View File

@ -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" } } */

View File

@ -987,6 +987,9 @@ struct GTY(()) tree_base {
SSA_NAME_IN_FREELIST in SSA_NAME_IN_FREELIST in
SSA_NAME SSA_NAME
VAR_DECL_NONALIASED in
VAR_DECL
deprecated_flag: deprecated_flag:
TREE_DEPRECATED in TREE_DEPRECATED in

View File

@ -2441,6 +2441,10 @@ extern void decl_fini_priority_insert (tree, priority_type);
#define DECL_NONLOCAL_FRAME(NODE) \ #define DECL_NONLOCAL_FRAME(NODE) \
(VAR_DECL_CHECK (NODE)->base.default_def_flag) (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 /* This field is used to reference anything in decl.result and is meant only
for use by the garbage collector. */ for use by the garbage collector. */
#define DECL_RESULT_FLD(NODE) \ #define DECL_RESULT_FLD(NODE) \
@ -4462,12 +4466,14 @@ static inline bool
may_be_aliased (const_tree var) may_be_aliased (const_tree var)
{ {
return (TREE_CODE (var) != CONST_DECL 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) && (TREE_PUBLIC (var)
|| DECL_EXTERNAL (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. */ /* Return pointer to optimization flags of FNDECL. */