aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-coalesce.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-01-04 21:02:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-01-04 21:02:42 +0000
commita7d04a5357719127b0ac3b8f139ccabf188f30b4 (patch)
tree0d4b71e06f20c74e023eb6aacd7690d252cf6d24 /gcc/tree-ssa-coalesce.c
parentd6de356aa3f8fa23a08ca801aa63c5e9cce58a20 (diff)
downloadgcc-a7d04a5357719127b0ac3b8f139ccabf188f30b4.zip
gcc-a7d04a5357719127b0ac3b8f139ccabf188f30b4.tar.gz
gcc-a7d04a5357719127b0ac3b8f139ccabf188f30b4.tar.bz2
tree-ssa-sccvn.c (get_or_alloc_constant_value_id): Allocate a new entry only if needed.
2010-01-04 Richard Guenther <rguenther@suse.de> * tree-ssa-sccvn.c (get_or_alloc_constant_value_id): Allocate a new entry only if needed. * tree-ssa-dom.c (lookup_avail_expr): Likewise. * tree-ssa-coalesce.c (find_coalesce_pair): Avoid one hashtable lookup. * tree-ssa-pre.c (sorted_array_from_bitmap_set): Pre-allocate the result array. (phi_translate): Handle CONSTANTs early. From-SVN: r155633
Diffstat (limited to 'gcc/tree-ssa-coalesce.c')
-rw-r--r--gcc/tree-ssa-coalesce.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 867e15c..b96d091 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -256,7 +256,7 @@ delete_coalesce_list (coalesce_list_p cl)
static coalesce_pair_p
find_coalesce_pair (coalesce_list_p cl, int p1, int p2, bool create)
{
- struct coalesce_pair p, *pair;
+ struct coalesce_pair p;
void **slot;
unsigned int hash;
@@ -272,22 +272,23 @@ find_coalesce_pair (coalesce_list_p cl, int p1, int p2, bool create)
p.second_element = p2;
}
-
hash = coalesce_pair_map_hash (&p);
- pair = (struct coalesce_pair *) htab_find_with_hash (cl->list, &p, hash);
+ slot = htab_find_slot_with_hash (cl->list, &p, hash,
+ create ? INSERT : NO_INSERT);
+ if (!slot)
+ return NULL;
- if (create && !pair)
+ if (!*slot)
{
+ struct coalesce_pair * pair = XNEW (struct coalesce_pair);
gcc_assert (cl->sorted == NULL);
- pair = XNEW (struct coalesce_pair);
pair->first_element = p.first_element;
pair->second_element = p.second_element;
pair->cost = 0;
- slot = htab_find_slot_with_hash (cl->list, pair, hash, INSERT);
- *(struct coalesce_pair **)slot = pair;
+ *slot = (void *)pair;
}
- return pair;
+ return (struct coalesce_pair *) *slot;
}
static inline void