From: Richard Biener Date: Fri, 21 Mar 2014 11:52:50 +0000 (+0000) Subject: re PR tree-optimization/60577 (inefficient FDO instrumentation code) X-Git-Tag: releases/gcc-4.9.0~361 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=400a4f6ca21e539aecb66f570d769f4579a6482c;p=thirdparty%2Fgcc.git re PR tree-optimization/60577 (inefficient FDO instrumentation code) 2014-03-21 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dc03b1d6058d..be0c8c484474 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-03-21 Richard Biener + + 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 * expr.c (expand_expr_real_1): Remove outdated comment. diff --git a/gcc/coverage.c b/gcc/coverage.c index 8b62403d121e..4c06fa47908c 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 611ccb4b0fdc..aac3dc95c67b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-21 Richard Biener + + PR tree-optimization/60577 + * gcc.dg/tree-ssa/ssa-lim-11.c: New testcase. + 2014-03-21 Tobias Burnus 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 000000000000..ea91a612376a --- /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; ibuf; + for (j=0; jbase.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. */