[PATCH] Minor DOM cleanup

Jeff Law law@redhat.com
Mon Sep 14 20:14:00 GMT 2015

Passing void * to avail_expr_hash was an artifact of the old htab 
interface.  Since we're no longer using that interface and call the 
hashing routine directly, we can just pass in the right type and avoid 
the annoying casting.

This simplifies class-ifying the available expression stack and related 
bits on the way to fixing 47679.

Bootstrapped and regression tested on x86_64-linux-gnu.  Installed on 
the trunk.

-------------- next part --------------
        PR tree-optimization/47679
	* tree-ssa-dom.c (avail_expr_hash): Pass a pointer to a real
	type rather than void *.

diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index e3eb0db..248d24f 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -231,7 +231,7 @@ static struct opt_stats_d opt_stats;
 /* Local functions.  */
 static void optimize_stmt (basic_block, gimple_stmt_iterator);
 static tree lookup_avail_expr (gimple, bool);
-static hashval_t avail_expr_hash (const void *);
+static hashval_t avail_expr_hash (struct expr_hash_elt *);
 static void htab_statistics (FILE *,
 			     const hash_table<expr_elt_hasher> &);
 static void record_cond (cond_equivalence *);
@@ -2661,9 +2661,9 @@ lookup_avail_expr (gimple stmt, bool insert)
    its operands.  */
 static hashval_t
-avail_expr_hash (const void *p)
+avail_expr_hash (struct expr_hash_elt *p)
-  const struct hashable_expr *expr = &((const struct expr_hash_elt *)p)->expr;
+  const struct hashable_expr *expr = &p->expr;
   inchash::hash hstate;
   inchash::add_hashable_expr (expr, hstate);

More information about the Gcc-patches mailing list