to memory.
(analyze_function): When analyzing noreturn nothrow call, do not compute
written stats; free bitmaps of vars early if possible.
(generate_summary): Only update bitmaps if computed.
(propagate): Only dump bitmaps if computed.
(ipa_reference_read_summary): Fix pasto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153529
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-10-24 Jan Hubicka <jh@suse.cz>
+
+ * ipa-reference.c (check_call): Noreturn notrhow calls do not write
+ to memory.
+ (analyze_function): When analyzing noreturn nothrow call, do not compute
+ written stats; free bitmaps of vars early if possible.
+ (generate_summary): Only update bitmaps if computed.
+ (propagate): Only dump bitmaps if computed.
+ (ipa_reference_read_summary): Fix pasto.
+
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-alias.c (nonaliasing_component_refs_p): Rename into...
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-alias.c (nonaliasing_component_refs_p): Rename into...
else
{
local->calls_read_all = true;
else
{
local->calls_read_all = true;
- local->calls_write_all = true;
+ /* When function does not reutrn, it is safe to ignore anythign it writes
+ to, because the effect will never happen. */
+ if ((flags & (ECF_NOTHROW | ECF_NORETURN))
+ != (ECF_NOTHROW | ECF_NORETURN))
+ local->calls_write_all = true;
#ifdef ENABLE_CHECKING
tree step;
#endif
#ifdef ENABLE_CHECKING
tree step;
#endif
+ ipa_reference_local_vars_info_t local;
if (dump_file)
fprintf (dump_file, "\n local analysis of %s\n", cgraph_node_name (fn));
if (dump_file)
fprintf (dump_file, "\n local analysis of %s\n", cgraph_node_name (fn));
scan_stmt_for_static_refs (&gsi, fn);
}
scan_stmt_for_static_refs (&gsi, fn);
}
+ local = get_reference_vars_info (fn)->local;
+ if ((flags_from_decl_or_type (decl) & (ECF_NOTHROW | ECF_NORETURN))
+ == (ECF_NOTHROW | ECF_NORETURN))
+ {
+ local->calls_write_all = false;
+ bitmap_clear (local->statics_written);
+ }
+
+ /* Free bitmaps of direct references if we can not use them anyway. */
+ if (local->calls_write_all)
+ BITMAP_FREE (local->statics_written);
+ if (local->calls_read_all)
+ BITMAP_FREE (local->statics_read);
+
+
#ifdef ENABLE_CHECKING
/* Verify that all local initializers was expanded by gimplifier. */
for (step = DECL_STRUCT_FUNCTION (decl)->local_decls;
#ifdef ENABLE_CHECKING
/* Verify that all local initializers was expanded by gimplifier. */
for (step = DECL_STRUCT_FUNCTION (decl)->local_decls;
removed from the local maps. This will include all of the
variables that were found to escape in the function
scanning. */
removed from the local maps. This will include all of the
variables that were found to escape in the function
scanning. */
- bitmap_and_into (l->statics_read,
- all_module_statics);
- bitmap_and_into (l->statics_written,
- all_module_statics);
+ if (l->statics_read)
+ bitmap_and_into (l->statics_read,
+ all_module_statics);
+ if (l->statics_written)
+ bitmap_and_into (l->statics_written,
+ all_module_statics);
}
BITMAP_FREE(module_statics_readonly);
}
BITMAP_FREE(module_statics_readonly);
"\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
"\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
- EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
- 0, index, bi)
- {
- fprintf (dump_file, "%s ",
- get_static_name (index));
- }
+ if (l->statics_read)
+ EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
+ 0, index, bi)
+ {
+ fprintf (dump_file, "%s ",
+ get_static_name (index));
+ }
fprintf (dump_file, "\n locals written: ");
fprintf (dump_file, "\n locals written: ");
- EXECUTE_IF_SET_IN_BITMAP (l->statics_written,
- 0, index, bi)
- {
- fprintf(dump_file, "%s ",
- get_static_name (index));
- }
+ if (l->statics_written)
+ EXECUTE_IF_SET_IN_BITMAP (l->statics_written,
+ 0, index, bi)
+ {
+ fprintf(dump_file, "%s ",
+ get_static_name (index));
+ }
if (l->calls_read_all)
fprintf (dump_file, "\n calls read all: ");
if (l->calls_write_all)
if (l->calls_read_all)
fprintf (dump_file, "\n calls read all: ");
if (l->calls_write_all)
/* Set the statics written. */
v_count = lto_input_sleb128 (ib);
if (v_count == -1)
/* Set the statics written. */
v_count = lto_input_sleb128 (ib);
if (v_count == -1)
- l->calls_read_all = true;
+ l->calls_write_all = true;
else
for (j = 0; j < (unsigned int)v_count; j++)
{
else
for (j = 0; j < (unsigned int)v_count; j++)
{
Indirect calls hsould be only counted and as inliner is replacing them
by direct calls, we can conclude if any indirect calls are left in body */
*read_all = true;
Indirect calls hsould be only counted and as inliner is replacing them
by direct calls, we can conclude if any indirect calls are left in body */
*read_all = true;
+ /* When function does not reutrn, it is safe to ignore anythign it writes
+ to, because the effect will never happen. */
+ if ((flags & (ECF_NOTHROW | ECF_NORETURN))
+ != (ECF_NOTHROW | ECF_NORETURN))
+ *write_all = true;
"\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
"\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
- EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
- 0, index, bi)
- {
- fprintf (dump_file, "%s ",
- get_static_name (index));
- }
+ if (node_l->statics_read)
+ EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
+ 0, index, bi)
+ {
+ fprintf (dump_file, "%s ",
+ get_static_name (index));
+ }
fprintf (dump_file, "\n locals written: ");
fprintf (dump_file, "\n locals written: ");
- EXECUTE_IF_SET_IN_BITMAP (node_l->statics_written,
- 0, index, bi)
- {
- fprintf(dump_file, "%s ",
- get_static_name (index));
- }
+ if (node_l->statics_written)
+ EXECUTE_IF_SET_IN_BITMAP (node_l->statics_written,
+ 0, index, bi)
+ {
+ fprintf(dump_file, "%s ",
+ get_static_name (index));
+ }
w_info = (struct ipa_dfs_info *) node->aux;
w = w_info->next_cycle;
w_info = (struct ipa_dfs_info *) node->aux;
w = w_info->next_cycle;
w = w_info->next_cycle;
}
fprintf (dump_file, "\n globals read: ");
w = w_info->next_cycle;
}
fprintf (dump_file, "\n globals read: ");
- EXECUTE_IF_SET_IN_BITMAP (node_g->statics_read,
- 0, index, bi)
- {
- fprintf (dump_file, "%s ",
- get_static_name (index));
- }
+ if (node_g->statics_read == all_module_statics)
+ fprintf (dump_file, "ALL");
+ else
+ EXECUTE_IF_SET_IN_BITMAP (node_g->statics_read,
+ 0, index, bi)
+ {
+ fprintf (dump_file, "%s ",
+ get_static_name (index));
+ }
fprintf (dump_file, "\n globals written: ");
fprintf (dump_file, "\n globals written: ");
- EXECUTE_IF_SET_IN_BITMAP (node_g->statics_written,
- 0, index, bi)
- {
- fprintf (dump_file, "%s ",
- get_static_name (index));
- }
+ if (node_g->statics_written == all_module_statics)
+ fprintf (dump_file, "ALL");
+ else
+ EXECUTE_IF_SET_IN_BITMAP (node_g->statics_written,
+ 0, index, bi)
+ {
+ fprintf (dump_file, "%s ",
+ get_static_name (index));
+ }