X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree-ssa-dom.c;h=b84532569889dd6b92b1f248f23888e1ee727fee;hb=dd29332d4bd99449bf701d64edd2598e852a0d1d;hp=dd9fd56678561df74f04eb6ee2aa6353289cf7e8;hpb=48e1416a24d50cacbb2a5e06a9ee61dd8cbee313;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index dd9fd566785..b8453256988 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1,5 +1,5 @@ /* SSA Dominator optimizations for trees - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Diego Novillo @@ -25,20 +25,19 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "flags.h" -#include "rtl.h" #include "tm_p.h" -#include "ggc.h" #include "basic-block.h" #include "cfgloop.h" #include "output.h" #include "expr.h" #include "function.h" #include "diagnostic.h" +#include "tree-pretty-print.h" +#include "gimple-pretty-print.h" #include "timevar.h" #include "tree-dump.h" #include "tree-flow.h" #include "domwalk.h" -#include "real.h" #include "tree-pass.h" #include "tree-ssa-propagate.h" #include "langhooks.h" @@ -2229,50 +2228,47 @@ lookup_avail_expr (gimple stmt, bool insert) void **slot; tree lhs; tree temp; - struct expr_hash_elt *element = XNEW (struct expr_hash_elt); + struct expr_hash_elt element; /* Get LHS of assignment or call, else NULL_TREE. */ lhs = gimple_get_lhs (stmt); - initialize_hash_element (stmt, lhs, element); + initialize_hash_element (stmt, lhs, &element); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "LKUP "); - print_expr_hash_elt (dump_file, element); + print_expr_hash_elt (dump_file, &element); } /* Don't bother remembering constant assignments and copy operations. Constants and copy operations are handled by the constant/copy propagator in optimize_stmt. */ - if (element->expr.kind == EXPR_SINGLE - && (TREE_CODE (element->expr.ops.single.rhs) == SSA_NAME - || is_gimple_min_invariant (element->expr.ops.single.rhs))) - { - free (element); - return NULL_TREE; - } + if (element.expr.kind == EXPR_SINGLE + && (TREE_CODE (element.expr.ops.single.rhs) == SSA_NAME + || is_gimple_min_invariant (element.expr.ops.single.rhs))) + return NULL_TREE; /* Finally try to find the expression in the main expression hash table. */ - slot = htab_find_slot_with_hash (avail_exprs, element, element->hash, + slot = htab_find_slot_with_hash (avail_exprs, &element, element.hash, (insert ? INSERT : NO_INSERT)); if (slot == NULL) - { - free (element); - return NULL_TREE; - } + return NULL_TREE; if (*slot == NULL) { - *slot = (void *) element; + struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt); + *element2 = element; + element2->stamp = element2; + *slot = (void *) element2; if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "2>>> "); - print_expr_hash_elt (dump_file, element); + print_expr_hash_elt (dump_file, element2); } - VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element); + VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element2); return NULL_TREE; } @@ -2289,8 +2285,6 @@ lookup_avail_expr (gimple stmt, bool insert) lhs = temp; } - free (element); - if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "FIND: "); @@ -2396,6 +2390,8 @@ degenerate_phi_result (gimple phi) if (arg == lhs) continue; + else if (!arg) + break; else if (!val) val = arg; else if (arg == val) @@ -2403,7 +2399,7 @@ degenerate_phi_result (gimple phi) /* We bring in some of operand_equal_p not only to speed things up, but also to avoid crashing when dereferencing the type of a released SSA name. */ - else if (!arg || TREE_CODE (val) != TREE_CODE (arg) + else if (TREE_CODE (val) != TREE_CODE (arg) || TREE_CODE (val) == SSA_NAME || !operand_equal_p (arg, val, 0)) break;