ipa-prop.c (ipa_check_stmt_modifications): Removed.
2009-05-18 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (ipa_check_stmt_modifications): Removed. (visit_store_addr_for_mod_analysis): New function. (ipa_detect_param_modifications): Use walk_stmt_load_store_addr_ops. (determine_cst_member_ptr): Use gimple_assign_single_p. (ipa_get_stmt_member_ptr_load_param): Use gimple_assign_single_p. (ipa_analyze_call_uses): Use !gimple_assign_rhs2 rather than number of operands. Don't check number of operands of a NOP_EXPR. * testsuite/gcc.dg/ipa/modif-1.c: Do not check for unmodified int parameter. From-SVN: r147645
This commit is contained in:
parent
f133d4a2aa
commit
8b75fc9ba6
|
@ -1,3 +1,13 @@
|
||||||
|
2009-05-18 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
|
* ipa-prop.c (ipa_check_stmt_modifications): Removed.
|
||||||
|
(visit_store_addr_for_mod_analysis): New function.
|
||||||
|
(ipa_detect_param_modifications): Use walk_stmt_load_store_addr_ops.
|
||||||
|
(determine_cst_member_ptr): Use gimple_assign_single_p.
|
||||||
|
(ipa_get_stmt_member_ptr_load_param): Use gimple_assign_single_p.
|
||||||
|
(ipa_analyze_call_uses): Use !gimple_assign_rhs2 rather than number of
|
||||||
|
operands. Don't check number of operands of a NOP_EXPR.
|
||||||
|
|
||||||
2009-05-18 Eric Fisher <joefoxreal@gmail.com>
|
2009-05-18 Eric Fisher <joefoxreal@gmail.com>
|
||||||
|
|
||||||
* doc/tree-ssa.texi (SSA Operands): Fix a mistake.
|
* doc/tree-ssa.texi (SSA Operands): Fix a mistake.
|
||||||
|
|
|
@ -172,48 +172,30 @@ ipa_initialize_node_params (struct cgraph_node *node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check STMT to detect whether a formal parameter is directly modified within
|
/* Callback of walk_stmt_load_store_addr_ops for the visit_store and visit_addr
|
||||||
STMT, the appropriate entry is updated in the modified flags of INFO.
|
parameters. If OP is a parameter declaration, mark it as modified in the
|
||||||
Directly means that this function does not check for modifications through
|
info structure passed in DATA. */
|
||||||
pointers or escaping addresses because all TREE_ADDRESSABLE parameters are
|
|
||||||
considered modified anyway. */
|
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
ipa_check_stmt_modifications (struct ipa_node_params *info, gimple stmt)
|
visit_store_addr_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
|
||||||
|
tree op, void *data)
|
||||||
{
|
{
|
||||||
int j;
|
struct ipa_node_params *info = (struct ipa_node_params *) data;
|
||||||
int index;
|
|
||||||
tree lhs;
|
|
||||||
|
|
||||||
switch (gimple_code (stmt))
|
if (TREE_CODE (op) == PARM_DECL)
|
||||||
{
|
{
|
||||||
case GIMPLE_ASSIGN:
|
int index = ipa_get_param_decl_index (info, op);
|
||||||
lhs = gimple_assign_lhs (stmt);
|
gcc_assert (index >= 0);
|
||||||
|
info->params[index].modified = true;
|
||||||
while (handled_component_p (lhs))
|
|
||||||
lhs = TREE_OPERAND (lhs, 0);
|
|
||||||
if (TREE_CODE (lhs) == SSA_NAME)
|
|
||||||
lhs = SSA_NAME_VAR (lhs);
|
|
||||||
index = ipa_get_param_decl_index (info, lhs);
|
|
||||||
if (index >= 0)
|
|
||||||
info->params[index].modified = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIMPLE_ASM:
|
|
||||||
/* Asm code could modify any of the parameters. */
|
|
||||||
for (j = 0; j < ipa_get_param_count (info); j++)
|
|
||||||
info->params[j].modified = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute which formal parameters of function associated with NODE are locally
|
/* Compute which formal parameters of function associated with NODE are locally
|
||||||
modified. Parameters may be modified in NODE if they are TREE_ADDRESSABLE,
|
modified or their address is taken. Note that this does not apply on
|
||||||
if they appear on the left hand side of an assignment or if there is an
|
parameters with SSA names but those can and should be analyzed
|
||||||
ASM_EXPR in the function. */
|
differently. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ipa_detect_param_modifications (struct cgraph_node *node)
|
ipa_detect_param_modifications (struct cgraph_node *node)
|
||||||
|
@ -222,27 +204,17 @@ ipa_detect_param_modifications (struct cgraph_node *node)
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
struct function *func;
|
struct function *func;
|
||||||
gimple_stmt_iterator gsi;
|
gimple_stmt_iterator gsi;
|
||||||
gimple stmt;
|
|
||||||
struct ipa_node_params *info = IPA_NODE_REF (node);
|
struct ipa_node_params *info = IPA_NODE_REF (node);
|
||||||
int i, count;
|
|
||||||
|
|
||||||
if (ipa_get_param_count (info) == 0 || info->modification_analysis_done)
|
if (ipa_get_param_count (info) == 0 || info->modification_analysis_done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
func = DECL_STRUCT_FUNCTION (decl);
|
func = DECL_STRUCT_FUNCTION (decl);
|
||||||
FOR_EACH_BB_FN (bb, func)
|
FOR_EACH_BB_FN (bb, func)
|
||||||
{
|
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||||
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
|
walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info, NULL,
|
||||||
{
|
visit_store_addr_for_mod_analysis,
|
||||||
stmt = gsi_stmt (gsi);
|
visit_store_addr_for_mod_analysis);
|
||||||
ipa_check_stmt_modifications (info, stmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
count = ipa_get_param_count (info);
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
if (TREE_ADDRESSABLE (ipa_get_param (info, i)))
|
|
||||||
info->params[i].modified = true;
|
|
||||||
|
|
||||||
info->modification_analysis_done = 1;
|
info->modification_analysis_done = 1;
|
||||||
}
|
}
|
||||||
|
@ -482,7 +454,7 @@ determine_cst_member_ptr (gimple call, tree arg, tree method_field,
|
||||||
gimple stmt = gsi_stmt (gsi);
|
gimple stmt = gsi_stmt (gsi);
|
||||||
tree lhs, rhs, fld;
|
tree lhs, rhs, fld;
|
||||||
|
|
||||||
if (!is_gimple_assign (stmt) || gimple_num_ops (stmt) != 2)
|
if (!gimple_assign_single_p (stmt))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lhs = gimple_assign_lhs (stmt);
|
lhs = gimple_assign_lhs (stmt);
|
||||||
|
@ -617,7 +589,7 @@ ipa_get_stmt_member_ptr_load_param (gimple stmt)
|
||||||
{
|
{
|
||||||
tree rhs;
|
tree rhs;
|
||||||
|
|
||||||
if (!is_gimple_assign (stmt) || gimple_num_ops (stmt) != 2)
|
if (!gimple_assign_single_p (stmt))
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
rhs = gimple_assign_rhs1 (stmt);
|
rhs = gimple_assign_rhs1 (stmt);
|
||||||
|
@ -797,7 +769,7 @@ ipa_analyze_call_uses (struct ipa_node_params *info, gimple call)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
def = SSA_NAME_DEF_STMT (cond);
|
def = SSA_NAME_DEF_STMT (cond);
|
||||||
if (!is_gimple_assign (def) || gimple_num_ops (def) != 3
|
if (!is_gimple_assign (def)
|
||||||
|| gimple_assign_rhs_code (def) != BIT_AND_EXPR
|
|| gimple_assign_rhs_code (def) != BIT_AND_EXPR
|
||||||
|| !integer_onep (gimple_assign_rhs2 (def)))
|
|| !integer_onep (gimple_assign_rhs2 (def)))
|
||||||
return;
|
return;
|
||||||
|
@ -808,8 +780,8 @@ ipa_analyze_call_uses (struct ipa_node_params *info, gimple call)
|
||||||
|
|
||||||
def = SSA_NAME_DEF_STMT (cond);
|
def = SSA_NAME_DEF_STMT (cond);
|
||||||
|
|
||||||
if (is_gimple_assign (def) && gimple_num_ops (def) == 2
|
if (is_gimple_assign (def)
|
||||||
&& gimple_assign_rhs_code (def) == NOP_EXPR)
|
&& CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def)))
|
||||||
{
|
{
|
||||||
cond = gimple_assign_rhs1 (def);
|
cond = gimple_assign_rhs1 (def);
|
||||||
if (!ipa_is_ssa_with_stmt_def (cond))
|
if (!ipa_is_ssa_with_stmt_def (cond))
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2009-05-18 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
|
* gcc.dg/ipa/modif-1.c: Do not check for unmodified int parameter.
|
||||||
|
|
||||||
2009-05-17 H.J. Lu <hongjiu.lu@intel.com>
|
2009-05-17 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR c/40172
|
PR c/40172
|
||||||
|
|
|
@ -15,12 +15,11 @@ void func4 (int *pi);
|
||||||
|
|
||||||
void the_test (struct whatever u, struct whatever v,
|
void the_test (struct whatever u, struct whatever v,
|
||||||
struct whatever w, struct whatever x,
|
struct whatever w, struct whatever x,
|
||||||
int i, int j, int k, int l)
|
int i, int k, int l)
|
||||||
{
|
{
|
||||||
struct whatever *pw = &w;
|
struct whatever *pw = &w;
|
||||||
int *pk = &k;
|
int *pk = &k;
|
||||||
|
|
||||||
j = l+3;
|
|
||||||
v.first = 9;
|
v.first = 9;
|
||||||
|
|
||||||
func1 (u);
|
func1 (u);
|
||||||
|
@ -28,7 +27,6 @@ void the_test (struct whatever u, struct whatever v,
|
||||||
func2 (pw);
|
func2 (pw);
|
||||||
func2 (&x);
|
func2 (&x);
|
||||||
func3 (i);
|
func3 (i);
|
||||||
func3 (j);
|
|
||||||
func4 (pk);
|
func4 (pk);
|
||||||
func4 (&l);
|
func4 (&l);
|
||||||
}
|
}
|
||||||
|
@ -40,5 +38,4 @@ void the_test (struct whatever u, struct whatever v,
|
||||||
/* { dg-final { scan-ipa-dump-not "param 4\[^\\n\]*modified" "inline" } } */
|
/* { dg-final { scan-ipa-dump-not "param 4\[^\\n\]*modified" "inline" } } */
|
||||||
/* { dg-final { scan-ipa-dump "param 5\[^\\n\]*modified" "inline" } } */
|
/* { dg-final { scan-ipa-dump "param 5\[^\\n\]*modified" "inline" } } */
|
||||||
/* { dg-final { scan-ipa-dump "param 6\[^\\n\]*modified" "inline" } } */
|
/* { dg-final { scan-ipa-dump "param 6\[^\\n\]*modified" "inline" } } */
|
||||||
/* { dg-final { scan-ipa-dump "param 7\[^\\n\]*modified" "inline" } } */
|
|
||||||
/* { dg-final { cleanup-ipa-dump "inline" } } */
|
/* { dg-final { cleanup-ipa-dump "inline" } } */
|
||||||
|
|
Loading…
Reference in New Issue