* ipa-cp.c (ipcp_update_callgraph): Use ipa_is_param_used.
(ipcp_estimate_growth): Likewise.
(ipcp_const_param_count): Likewise.
(ipcp_insert_stage): Likewise.
* ipa-prop.c (visit_load_for_mod_analysis): New function.
(visit_store_addr_for_mod_analysis): Set used flag.
(ipa_detect_param_modifications): Set used flag for SSE params;
update use of walk_stmt_load_store_addr_ops.
(ipa_print_node_params): Print used flag.
(ipa_write_node_info): Stream used flag.
(ipa_read_node_info): Likewise.
* ipa-prop.h (struct ipa_param_descriptor): Add used field.
(ipa_is_param_used): New function.
(lto_ipa_fixup_call_notes): Remove unused declaration.
From-SVN: r159513
+2010-05-17 Jan Hubicka <jh@suse.cz>
+
+ * ipa-cp.c (ipcp_update_callgraph): Use ipa_is_param_used.
+ (ipcp_estimate_growth): Likewise.
+ (ipcp_const_param_count): Likewise.
+ (ipcp_insert_stage): Likewise.
+ * ipa-prop.c (visit_load_for_mod_analysis): New function.
+ (visit_store_addr_for_mod_analysis): Set used flag.
+ (ipa_detect_param_modifications): Set used flag for SSE params;
+ update use of walk_stmt_load_store_addr_ops.
+ (ipa_print_node_params): Print used flag.
+ (ipa_write_node_info): Stream used flag.
+ (ipa_read_node_info): Likewise.
+ * ipa-prop.h (struct ipa_param_descriptor): Add used field.
+ (ipa_is_param_used): New function.
+ (lto_ipa_fixup_call_notes): Remove unused declaration.
+
2010-05-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/44074
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
- tree parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
- if (is_gimple_reg (parm_tree)
- && !gimple_default_def (DECL_STRUCT_FUNCTION (orig_node->decl),
- parm_tree))
+ if (!ipa_is_param_used (info, i))
{
bitmap_set_bit (args_to_skip, i);
continue;
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
- tree parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
- if (is_gimple_reg (parm_tree)
- && !gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
- parm_tree))
+ if (!ipa_is_param_used (info, i))
removable_args++;
if (lat->type == IPA_CONST_VALUE)
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
- tree parm_tree = ipa_get_param (info, i);
if (ipcp_lat_is_insertable (lat)
/* Do not count obviously unused arguments. */
- && (!is_gimple_reg (parm_tree)
- || gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
- parm_tree)))
+ && ipa_is_param_used (info, i))
const_param++;
}
return const_param;
parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
- if (is_gimple_reg (parm_tree)
- && !gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
- parm_tree))
+ if (!ipa_is_param_used (info, i))
{
bitmap_set_bit (args_to_skip, i);
continue;
int index = ipa_get_param_decl_index (info, op);
gcc_assert (index >= 0);
info->params[index].modified = true;
+ info->params[index].used = true;
+ }
+
+ return false;
+}
+
+/* Callback of walk_stmt_load_store_addr_ops for the visit_load.
+ If OP is a parameter declaration, mark it as used in the info structure
+ passed in DATA. */
+
+static bool
+visit_load_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
+ tree op, void *data)
+{
+ struct ipa_node_params *info = (struct ipa_node_params *) data;
+
+ op = get_base_address (op);
+ if (op
+ && TREE_CODE (op) == PARM_DECL)
+ {
+ int index = ipa_get_param_decl_index (info, op);
+ gcc_assert (index >= 0);
+ info->params[index].used = true;
}
return false;
struct function *func;
gimple_stmt_iterator gsi;
struct ipa_node_params *info = IPA_NODE_REF (node);
+ int i;
if (ipa_get_param_count (info) == 0 || info->modification_analysis_done)
return;
+ for (i = 0; i < ipa_get_param_count (info); i++)
+ {
+ tree parm = ipa_get_param (info, i);
+ /* For SSA regs see if parameter is used. For non-SSA we compute
+ the flag during modification analysis. */
+ if (is_gimple_reg (parm)
+ && gimple_default_def (DECL_STRUCT_FUNCTION (node->decl), parm))
+ info->params[i].used = true;
+ }
+
func = DECL_STRUCT_FUNCTION (decl);
FOR_EACH_BB_FN (bb, func)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info, NULL,
+ walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
+ visit_load_for_mod_analysis,
visit_store_addr_for_mod_analysis,
visit_store_addr_for_mod_analysis);
: "(unnamed)"));
if (ipa_is_param_modified (info, i))
fprintf (f, " modified");
+ if (ipa_is_param_used (info, i))
+ fprintf (f, " used");
fprintf (f, "\n");
}
}
gcc_assert (!info->node_enqueued);
gcc_assert (!info->ipcp_orig_node);
for (j = 0; j < ipa_get_param_count (info); j++)
- bp_pack_value (bp, info->params[j].modified, 1);
+ {
+ bp_pack_value (bp, info->params[j].modified, 1);
+ bp_pack_value (bp, info->params[j].used, 1);
+ }
lto_output_bitpack (ob->main_stream, bp);
bitpack_delete (bp);
for (e = node->callees; e; e = e->next_callee)
}
info->node_enqueued = false;
for (k = 0; k < ipa_get_param_count (info); k++)
- info->params[k].modified = bp_unpack_value (bp, 1);
+ {
+ info->params[k].modified = bp_unpack_value (bp, 1);
+ info->params[k].used = bp_unpack_value (bp, 1);
+ }
bitpack_delete (bp);
for (e = node->callees; e; e = e->next_callee)
{
tree decl;
/* Whether the value parameter has been modified within the function. */
unsigned modified : 1;
+ /* The parameter is used. */
+ unsigned used : 1;
};
/* ipa_node_params stores information related to formal parameters of functions
return info->params[i].modified;
}
+/* Return the used flag corresponding to the Ith formal parameter of
+ the function associated with INFO. */
+
+static inline bool
+ipa_is_param_used (struct ipa_node_params *info, int i)
+{
+ return info->params[i].used;
+}
+
/* Flag this node as having callers with variable number of arguments. */
static inline void
void ipa_prop_write_jump_functions (cgraph_node_set set);
void ipa_prop_read_jump_functions (void);
void ipa_update_after_lto_read (void);
-void lto_ipa_fixup_call_notes (struct cgraph_node *, gimple *);
/* From tree-sra.c: */
bool build_ref_for_offset (tree *, tree, HOST_WIDE_INT, tree, bool);