tree-ssa-pre.c (get_or_alloc_expr_for_name): Avoid redundant allocation and lookup.
2010-01-05 Richard Guenther <rguenther@suse.de> * tree-ssa-pre.c (get_or_alloc_expr_for_name): Avoid redundant allocation and lookup. (get_or_alloc_expr_for_constant): Likewise. (phi_translate): Sink allocation. From-SVN: r155635
This commit is contained in:
parent
ed945ad9f1
commit
5f5126d6ce
@ -1,3 +1,10 @@
|
|||||||
|
2010-01-05 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
* tree-ssa-pre.c (get_or_alloc_expr_for_name): Avoid redundant
|
||||||
|
allocation and lookup.
|
||||||
|
(get_or_alloc_expr_for_constant): Likewise.
|
||||||
|
(phi_translate): Sink allocation.
|
||||||
|
|
||||||
2010-01-04 Richard Guenther <rguenther@suse.de>
|
2010-01-04 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* tree-ssa-sccvn.c (get_or_alloc_constant_value_id): Allocate
|
* tree-ssa-sccvn.c (get_or_alloc_constant_value_id): Allocate
|
||||||
|
@ -308,20 +308,21 @@ static alloc_pool pre_expr_pool;
|
|||||||
static pre_expr
|
static pre_expr
|
||||||
get_or_alloc_expr_for_name (tree name)
|
get_or_alloc_expr_for_name (tree name)
|
||||||
{
|
{
|
||||||
pre_expr result = (pre_expr) pool_alloc (pre_expr_pool);
|
struct pre_expr_d expr;
|
||||||
|
pre_expr result;
|
||||||
unsigned int result_id;
|
unsigned int result_id;
|
||||||
|
|
||||||
result->kind = NAME;
|
expr.kind = NAME;
|
||||||
result->id = 0;
|
expr.id = 0;
|
||||||
PRE_EXPR_NAME (result) = name;
|
PRE_EXPR_NAME (&expr) = name;
|
||||||
result_id = lookup_expression_id (result);
|
result_id = lookup_expression_id (&expr);
|
||||||
if (result_id != 0)
|
if (result_id != 0)
|
||||||
{
|
return expression_for_id (result_id);
|
||||||
pool_free (pre_expr_pool, result);
|
|
||||||
result = expression_for_id (result_id);
|
result = (pre_expr) pool_alloc (pre_expr_pool);
|
||||||
return result;
|
result->kind = NAME;
|
||||||
}
|
PRE_EXPR_NAME (result) = name;
|
||||||
get_or_alloc_expression_id (result);
|
alloc_expression_id (result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,18 +1024,20 @@ get_or_alloc_expr_for_constant (tree constant)
|
|||||||
{
|
{
|
||||||
unsigned int result_id;
|
unsigned int result_id;
|
||||||
unsigned int value_id;
|
unsigned int value_id;
|
||||||
pre_expr newexpr = (pre_expr) pool_alloc (pre_expr_pool);
|
struct pre_expr_d expr;
|
||||||
|
pre_expr newexpr;
|
||||||
|
|
||||||
|
expr.kind = CONSTANT;
|
||||||
|
PRE_EXPR_CONSTANT (&expr) = constant;
|
||||||
|
result_id = lookup_expression_id (&expr);
|
||||||
|
if (result_id != 0)
|
||||||
|
return expression_for_id (result_id);
|
||||||
|
|
||||||
|
newexpr = (pre_expr) pool_alloc (pre_expr_pool);
|
||||||
newexpr->kind = CONSTANT;
|
newexpr->kind = CONSTANT;
|
||||||
PRE_EXPR_CONSTANT (newexpr) = constant;
|
PRE_EXPR_CONSTANT (newexpr) = constant;
|
||||||
result_id = lookup_expression_id (newexpr);
|
alloc_expression_id (newexpr);
|
||||||
if (result_id != 0)
|
|
||||||
{
|
|
||||||
pool_free (pre_expr_pool, newexpr);
|
|
||||||
newexpr = expression_for_id (result_id);
|
|
||||||
return newexpr;
|
|
||||||
}
|
|
||||||
value_id = get_or_alloc_constant_value_id (constant);
|
value_id = get_or_alloc_constant_value_id (constant);
|
||||||
get_or_alloc_expression_id (newexpr);
|
|
||||||
add_to_value (value_id, newexpr);
|
add_to_value (value_id, newexpr);
|
||||||
return newexpr;
|
return newexpr;
|
||||||
}
|
}
|
||||||
@ -1499,6 +1502,7 @@ phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
|
|||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
pre_expr constant;
|
pre_expr constant;
|
||||||
|
unsigned int new_val_id;
|
||||||
|
|
||||||
tree result = vn_nary_op_lookup_pieces (newnary.length,
|
tree result = vn_nary_op_lookup_pieces (newnary.length,
|
||||||
newnary.opcode,
|
newnary.opcode,
|
||||||
@ -1508,15 +1512,12 @@ phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
|
|||||||
newnary.op[2],
|
newnary.op[2],
|
||||||
newnary.op[3],
|
newnary.op[3],
|
||||||
&nary);
|
&nary);
|
||||||
unsigned int new_val_id;
|
if (result && is_gimple_min_invariant (result))
|
||||||
|
return get_or_alloc_expr_for_constant (result);
|
||||||
|
|
||||||
expr = (pre_expr) pool_alloc (pre_expr_pool);
|
expr = (pre_expr) pool_alloc (pre_expr_pool);
|
||||||
expr->kind = NARY;
|
expr->kind = NARY;
|
||||||
expr->id = 0;
|
expr->id = 0;
|
||||||
if (result && is_gimple_min_invariant (result))
|
|
||||||
return get_or_alloc_expr_for_constant (result);
|
|
||||||
|
|
||||||
|
|
||||||
if (nary)
|
if (nary)
|
||||||
{
|
{
|
||||||
PRE_EXPR_NARY (expr) = nary;
|
PRE_EXPR_NARY (expr) = nary;
|
||||||
|
Loading…
Reference in New Issue
Block a user