diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2012-04-16 12:15:50 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2012-04-16 12:15:50 +0000 |
commit | fba621209f542447474d7e1b5d33ba21df14f04d (patch) | |
tree | ce7aa9f7137c59fbc3a76d5807df7d3891bfc3b4 /gcc | |
parent | 65c70e6b0311be59bddaba52ab10d837b61ea574 (diff) | |
download | gcc-fba621209f542447474d7e1b5d33ba21df14f04d.zip gcc-fba621209f542447474d7e1b5d33ba21df14f04d.tar.gz gcc-fba621209f542447474d7e1b5d33ba21df14f04d.tar.bz2 |
re PR tree-optimization/52976 (Revision 186384 breaks the polyhedron tests aermod.f90 and doduc.f90 at -O3 -ffast-math)
2012-04-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/52976
* tree-ssa-reassoc.c (add_to_ops_vec_max_rank): New function.
(undistribute_ops_list): Ops with repeat counts aren't eligible for
undistribution.
(attempt_builtin_powi): Call add_to_ops_vec_max_rank.
From-SVN: r186493
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 33 |
2 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb23d46..a1f2b4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-04-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/52976 + * tree-ssa-reassoc.c (add_to_ops_vec_max_rank): New function. + (undistribute_ops_list): Ops with repeat counts aren't eligible for + undistribution. + (attempt_builtin_powi): Call add_to_ops_vec_max_rank. + 2012-04-16 Jan Hubicka <jh@suse.cz> * cgraph.h (FOR_EACH_VARIABLE, FOR_EACH_VARIABLE, FOR_EACH_FUNCTION): diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 4385fbf..854ce00 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -544,6 +544,28 @@ add_repeat_to_ops_vec (VEC(operand_entry_t, heap) **ops, tree op, reassociate_stats.pows_encountered++; } +/* Add an operand entry to *OPS for the tree operand OP, giving the + new entry a larger rank than any other operand already in *OPS. */ + +static void +add_to_ops_vec_max_rank (VEC(operand_entry_t, heap) **ops, tree op) +{ + operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe1; + unsigned i; + unsigned max_rank = 0; + + FOR_EACH_VEC_ELT (operand_entry_t, *ops, i, oe1) + if (oe1->rank > max_rank) + max_rank = oe1->rank; + + oe->op = op; + oe->rank = max_rank + 1; + oe->id = next_operand_entry_id++; + oe->count = 1; + VEC_safe_push (operand_entry_t, heap, *ops, oe); +} + /* Return true if STMT is reassociable operation containing a binary operation with tree code CODE, and is inside LOOP. */ @@ -1200,6 +1222,7 @@ undistribute_ops_list (enum tree_code opcode, dcode = gimple_assign_rhs_code (oe1def); if ((dcode != MULT_EXPR && dcode != RDIV_EXPR) + || oe1->count != 1 || !is_reassociable_op (oe1def, dcode, loop)) continue; @@ -1243,6 +1266,8 @@ undistribute_ops_list (enum tree_code opcode, oecount c; void **slot; size_t idx; + if (oe1->count != 1) + continue; c.oecode = oecode; c.cnt = 1; c.id = next_oecount_id++; @@ -1311,7 +1336,7 @@ undistribute_ops_list (enum tree_code opcode, FOR_EACH_VEC_ELT (operand_entry_t, subops[i], j, oe1) { - if (oe1->op == c->op) + if (oe1->op == c->op && oe1->count == 1) { SET_BIT (candidates2, i); ++nr_candidates2; @@ -3275,8 +3300,10 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops, gsi_insert_before (&gsi, pow_stmt, GSI_SAME_STMT); } - /* Append the result of this iteration to the ops vector. */ - add_to_ops_vec (ops, iter_result); + /* Append the result of this iteration to the ops vector. + Give it a rank higher than all other ranks in the ops vector + so that all uses of it will be forced to come after it. */ + add_to_ops_vec_max_rank (ops, iter_result); /* Decrement the occurrence count of each element in the product by the count found above, and remove this many copies of each |