summaryrefslogtreecommitdiff
path: root/gcc/tree-parloops.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-20 21:46:40 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-20 21:46:40 +0000
commitb08e05713256fbd8a2a414b56c82d1651aadb985 (patch)
tree31bad5c89150cded27efde181d7eee13ce078edb /gcc/tree-parloops.c
parent79bd8aab8f7dedd773f23cbf2c109d9f77cd47d7 (diff)
downloadgcc-b08e05713256fbd8a2a414b56c82d1651aadb985.tar.gz
2010-12-20 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 168094 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@168096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r--gcc/tree-parloops.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 25ef2f29454..ea1911a81fa 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -168,6 +168,8 @@ struct reduction_info
gimple reduc_stmt; /* reduction statement. */
gimple reduc_phi; /* The phi node defining the reduction. */
enum tree_code reduction_code;/* code for the reduction operation. */
+ unsigned reduc_version; /* SSA_NAME_VERSION of original reduc_phi
+ result. */
gimple keep_res; /* The PHI_RESULT of this phi is the resulting value
of the reduction variable when existing the loop. */
tree initial_value; /* The initial value of the reduction var before entering the loop. */
@@ -195,7 +197,7 @@ reduction_info_hash (const void *aa)
{
const struct reduction_info *a = (const struct reduction_info *) aa;
- return htab_hash_pointer (a->reduc_phi);
+ return a->reduc_version;
}
static struct reduction_info *
@@ -207,6 +209,7 @@ reduction_phi (htab_t reduction_list, gimple phi)
return NULL;
tmpred.reduc_phi = phi;
+ tmpred.reduc_version = gimple_uid (phi);
red = (struct reduction_info *) htab_find (reduction_list, &tmpred);
return red;
@@ -1774,11 +1777,22 @@ build_new_reduction (htab_t reduction_list, gimple reduc_stmt, gimple phi)
new_reduction->reduc_stmt = reduc_stmt;
new_reduction->reduc_phi = phi;
+ new_reduction->reduc_version = SSA_NAME_VERSION (gimple_phi_result (phi));
new_reduction->reduction_code = gimple_assign_rhs_code (reduc_stmt);
slot = htab_find_slot (reduction_list, new_reduction, INSERT);
*slot = new_reduction;
}
+/* Callback for htab_traverse. Sets gimple_uid of reduc_phi stmts. */
+
+static int
+set_reduc_phi_uids (void **slot, void *data ATTRIBUTE_UNUSED)
+{
+ struct reduction_info *const red = (struct reduction_info *) *slot;
+ gimple_set_uid (red->reduc_phi, red->reduc_version);
+ return 1;
+}
+
/* Detect all reductions in the LOOP, insert them into REDUCTION_LIST. */
static void
@@ -1810,7 +1824,12 @@ gather_scalar_reductions (loop_p loop, htab_t reduction_list)
build_new_reduction (reduction_list, reduc_stmt, phi);
}
}
- destroy_loop_vec_info (simple_loop_info, true);
+ destroy_loop_vec_info (simple_loop_info, true);
+
+ /* As gimple_uid is used by the vectorizer in between vect_analyze_loop_form
+ and destroy_loop_vec_info, we can set gimple_uid of reduc_phi stmts
+ only now. */
+ htab_traverse (reduction_list, set_reduc_phi_uids, NULL);
}
/* Try to initialize NITER for code generation part. */