===================================================================
@@ -2383,65 +2383,27 @@
/* Worker to set nothrow flag. */
-static void
-set_nothrow_flag_1 (cgraph_node *node, bool nothrow, bool non_call,
- bool *changed)
+static bool
+cgraph_set_nothrow_flag_1 (cgraph_node *node, void *data)
{
cgraph_edge *e;
- if (nothrow && !TREE_NOTHROW (node->decl))
- {
- /* With non-call exceptions we can't say for sure if other function body
- was not possibly optimized to stil throw. */
- if (!non_call || node->binds_to_current_def_p ())
- {
- TREE_NOTHROW (node->decl) = true;
- *changed = true;
- for (e = node->callers; e; e = e->next_caller)
- e->can_throw_external = false;
- }
- }
- else if (!nothrow && TREE_NOTHROW (node->decl))
- {
- TREE_NOTHROW (node->decl) = false;
- *changed = true;
- }
- ipa_ref *ref;
- FOR_EACH_ALIAS (node, ref)
- {
- cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (!nothrow || alias->get_availability () > AVAIL_INTERPOSABLE)
- set_nothrow_flag_1 (alias, nothrow, non_call, changed);
- }
- for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p
- && (!nothrow || e->caller->get_availability () > AVAIL_INTERPOSABLE))
- set_nothrow_flag_1 (e->caller, nothrow, non_call, changed);
+ TREE_NOTHROW (node->decl) = data != NULL;
+
+ if (data != NULL)
+ for (e = node->callers; e; e = e->next_caller)
+ e->can_throw_external = false;
+ return false;
}
/* Set TREE_NOTHROW on NODE's decl and on aliases of NODE
if any to NOTHROW. */
-bool
+void
cgraph_node::set_nothrow_flag (bool nothrow)
{
- bool changed = false;
- bool non_call = opt_for_fn (decl, flag_non_call_exceptions);
-
- if (!nothrow || get_availability () > AVAIL_INTERPOSABLE)
- set_nothrow_flag_1 (this, nothrow, non_call, &changed);
- else
- {
- ipa_ref *ref;
-
- FOR_EACH_ALIAS (this, ref)
- {
- cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (!nothrow || alias->get_availability () > AVAIL_INTERPOSABLE)
- set_nothrow_flag_1 (alias, nothrow, non_call, &changed);
- }
- }
- return changed;
+ call_for_symbol_thunks_and_aliases (cgraph_set_nothrow_flag_1,
+ (void *)(size_t)nothrow, nothrow == true);
}
/* Worker to set_const_flag. */
@@ -2580,7 +2542,8 @@
/* Info used by set_pure_flag_1. */
-struct set_pure_flag_info
+struct
+set_pure_flag_info
{
bool pure;
bool looping;
===================================================================
@@ -1111,7 +1111,7 @@
/* Set TREE_NOTHROW on cgraph_node's decl and on aliases of the node
if any to NOTHROW. */
- bool set_nothrow_flag (bool nothrow);
+ void set_nothrow_flag (bool nothrow);
/* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST.
If SET_CONST if false, clear the flag.
===================================================================
@@ -1167,10 +1167,7 @@
enum availability avail;
cgraph_node *n = e->callee->function_or_virtual_thunk_symbol (&avail,
e->caller);
- if (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (n->decl))
- return true;
- return opt_for_fn (e->callee->decl, flag_non_call_exceptions)
- && !e->callee->binds_to_current_def_p (e->caller);
+ return (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (n->decl));
}
/* Return true if NODE is self recursive function.
@@ -1601,20 +1598,14 @@
continue;
struct cgraph_node *y = e->callee->
- function_or_virtual_thunk_symbol (&avail,
- e->caller);
+ function_or_virtual_thunk_symbol (&avail,
+ e->caller);
/* We can use info about the callee only if we know it can
- not be interposed.
- When callee is compiled with non-call exceptions we also
- must check that the declaration is bound to current
- body as other semantically equivalent body may still
- throw. */
+ not be interposed. */
if (avail <= AVAIL_INTERPOSABLE
|| (!TREE_NOTHROW (y->decl)
- && (get_function_state (y)->can_throw
- || (opt_for_fn (y->decl, flag_non_call_exceptions)
- && !e->callee->binds_to_current_def_p (w)))))
+ && get_function_state (y)->can_throw))
can_throw = true;
}
for (ie = w->indirect_calls; ie && !can_throw;