From bb9e419935d5ef9fd90d27ed818b91fb6d49c68a Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Sat, 19 Jul 2008 20:02:29 +0000 Subject: [PATCH] re PR bootstrap/36864 (Yet another bootstrap failure on i686-apple-darwin9) 2008-07-19 Richard Guenther PR bootstrap/36864 * tree-ssa-sccvn.h (get_constant_value_id): Declare. * tree-ssa-sccvn.c (get_constant_value_id): New function. * tree-ssa-pre.c (get_expr_value_id): For newly created constant value-ids make sure to add the expression to its expression-set. From-SVN: r137991 --- gcc/ChangeLog | 9 +++++++++ gcc/tree-ssa-pre.c | 11 ++++++++++- gcc/tree-ssa-sccvn.c | 18 ++++++++++++++++++ gcc/tree-ssa-sccvn.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 701b25f787e..50edf353df9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-07-19 Richard Guenther + + PR bootstrap/36864 + * tree-ssa-sccvn.h (get_constant_value_id): Declare. + * tree-ssa-sccvn.c (get_constant_value_id): New function. + * tree-ssa-pre.c (get_expr_value_id): For newly created + constant value-ids make sure to add the expression to its + expression-set. + 2008-07-19 Jakub Jelinek PR middle-end/36877 diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index efa934fb853..ed337a39c46 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -599,7 +599,16 @@ get_expr_value_id (pre_expr expr) switch (expr->kind) { case CONSTANT: - return get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr)); + { + unsigned int id; + id = get_constant_value_id (PRE_EXPR_CONSTANT (expr)); + if (id == 0) + { + id = get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr)); + add_to_value (id, expr); + } + return id; + } case NAME: return VN_INFO (PRE_EXPR_NAME (expr))->value_id; case NARY: diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 69945a5c3c7..48b5297b4d8 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -248,6 +248,24 @@ vn_constant_hash (const void *p1) return vc1->hashcode; } +/* Lookup a value id for CONSTANT and return it. If it does not + exist returns 0. */ + +unsigned int +get_constant_value_id (tree constant) +{ + void **slot; + struct vn_constant_s vc; + + vc.hashcode = iterative_hash_expr (constant, 0); + vc.constant = constant; + slot = htab_find_slot_with_hash (constant_to_value_id, &vc, + vc.hashcode, NO_INSERT); + if (slot) + return ((vn_constant_t)*slot)->value_id; + return 0; +} + /* Lookup a value id for CONSTANT, and if it does not exist, create a new one and return it. If it does exist, return it. */ diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index 9f391af43aa..314cf8f8c9b 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -163,6 +163,7 @@ hashval_t vn_reference_compute_hash (const vn_reference_t); int vn_reference_eq (const void *, const void *); unsigned int get_max_value_id (void); unsigned int get_next_value_id (void); +unsigned int get_constant_value_id (tree); unsigned int get_or_alloc_constant_value_id (tree); bool value_id_constant_p (unsigned int); VEC (tree, gc) *shared_vuses_from_stmt (tree); -- 2.30.2