diff options
author | Richard Biener <rguenther@suse.de> | 2012-10-30 14:14:04 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-10-30 14:14:04 +0000 |
commit | c12d9242290c13be552bd6fa6c0524ef9aa650e6 (patch) | |
tree | 27eee1b7d0801cca31979014c870c66a30fe182c /gcc | |
parent | 2e2e628b24501fc8362ec1797c331091e702f5a5 (diff) | |
download | gcc-c12d9242290c13be552bd6fa6c0524ef9aa650e6.zip gcc-c12d9242290c13be552bd6fa6c0524ef9aa650e6.tar.gz gcc-c12d9242290c13be552bd6fa6c0524ef9aa650e6.tar.bz2 |
gimple.h (gimple_store_p): New predicate.
2012-10-30 Richard Biener <rguenther@suse.de>
* gimple.h (gimple_store_p): New predicate.
(gimple_assign_load_p): Likewise.
* tree-inline.c (estimate_num_insns): Use it.
* gcc.dg/vect/slp-perm-2.c: Adjust.
From-SVN: r192987
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple.h | 25 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/slp-perm-2.c | 3 | ||||
-rw-r--r-- | gcc/tree-inline.c | 10 |
5 files changed, 42 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cf846b..b1eabfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-10-30 Richard Biener <rguenther@suse.de> + + * gimple.h (gimple_store_p): New predicate. + (gimple_assign_load_p): Likewise. + * tree-inline.c (estimate_num_insns): Use it. + 2012-10-30 Marc Glisse <marc.glisse@inria.fr> * fold-const.c (fold_binary_op_with_conditional_arg): Handle vectors. diff --git a/gcc/gimple.h b/gcc/gimple.h index b34016a..19d45d0 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -2041,6 +2041,31 @@ gimple_assign_single_p (gimple gs) && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); } +/* Return true if GS performs a store to its lhs. */ + +static inline bool +gimple_store_p (gimple gs) +{ + tree lhs = gimple_get_lhs (gs); + return lhs && !is_gimple_reg (lhs); +} + +/* Return true if GS is an assignment that loads from its rhs1. */ + +static inline bool +gimple_assign_load_p (gimple gs) +{ + tree rhs; + if (!gimple_assign_single_p (gs)) + return false; + rhs = gimple_assign_rhs1 (gs); + if (TREE_CODE (rhs) == WITH_SIZE_EXPR) + return true; + rhs = get_base_address (rhs); + return (DECL_P (rhs) + || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF); +} + /* Return true if S is a type-cast assignment. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87520a3..6573b8d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2012-10-30 Richard Biener <rguenther@suse.de> + * gcc.dg/vect/slp-perm-2.c: Adjust. + +2012-10-30 Richard Biener <rguenther@suse.de> + PR tree-optimization/55111 * gcc.dg/torture/pr55111.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-2.c b/gcc/testsuite/gcc.dg/vect/slp-perm-2.c index 1bc95e2..27156f4 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-2.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-2.c @@ -12,7 +12,8 @@ #define N 16 -void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) +void __attribute__((noinline)) +foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) { unsigned int i, a, b; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 2c8071e..69a664d 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3512,12 +3512,12 @@ estimate_num_insns (gimple stmt, eni_weights *weights) lhs = gimple_assign_lhs (stmt); rhs = gimple_assign_rhs1 (stmt); - if (is_gimple_reg (lhs)) - cost = 0; - else - cost = estimate_move_cost (TREE_TYPE (lhs)); + cost = 0; - if (!is_gimple_reg (rhs) && !is_gimple_min_invariant (rhs)) + /* Account for the cost of moving to / from memory. */ + if (gimple_store_p (stmt)) + cost += estimate_move_cost (TREE_TYPE (lhs)); + if (gimple_assign_load_p (stmt)) cost += estimate_move_cost (TREE_TYPE (rhs)); cost += estimate_operator_cost (gimple_assign_rhs_code (stmt), weights, |