auto_vec <cgraph_node *, 16> stack;
int node_scc_count = ipa_reduced_postorder (order, true, NULL);
- /* One sweep from callees to callers for parameter removal and splitting. */
- for (int i = 0; i < node_scc_count; i++)
+ /* One sweep from callers to callees for return value removal. */
+ for (int i = node_scc_count - 1; i >= 0 ; i--)
{
cgraph_node *scc_rep = order[i];
vec<cgraph_node *> cycle_nodes = ipa_get_nodes_in_cycle (scc_rep);
- unsigned j;
- /* Preliminary IPA function level checks and first step of parameter
- removal. */
- cgraph_node *v;
- FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ /* Preliminary IPA function level checks. */
+ for (cgraph_node *v : cycle_nodes)
{
isra_func_summary *ifs = func_sums->get (v);
if (!ifs || !ifs->m_candidate)
continue;
if (!ipa_sra_ipa_function_checks (v)
|| check_all_callers_for_issues (v))
- {
- ifs->zap ();
- continue;
- }
+ ifs->zap ();
+ }
+
+ for (cgraph_node *v : cycle_nodes)
+ {
+ isra_func_summary *ifs = func_sums->get (v);
+ if (!ifs || !ifs->m_candidate)
+ continue;
+ bool return_needed
+ = (ifs->m_returns_value
+ && (!dbg_cnt (ipa_sra_retvalues)
+ || v->call_for_symbol_and_aliases (retval_used_p,
+ NULL, true)));
+ ifs->m_return_ignored = !return_needed;
+ if (return_needed)
+ isra_push_node_to_stack (v, ifs, &stack);
+ }
+
+ while (!stack.is_empty ())
+ {
+ cgraph_node *node = stack.pop ();
+ isra_func_summary *ifs = func_sums->get (node);
+ gcc_checking_assert (ifs && ifs->m_queued);
+ ifs->m_queued = false;
+
+ for (cgraph_edge *cs = node->callees; cs; cs = cs->next_callee)
+ if (ipa_edge_within_scc (cs)
+ && call_sums->get (cs)->m_return_returned)
+ {
+ enum availability av;
+ cgraph_node *callee = cs->callee->function_symbol (&av);
+ isra_func_summary *to_ifs = func_sums->get (callee);
+ if (to_ifs && to_ifs->m_return_ignored)
+ {
+ to_ifs->m_return_ignored = false;
+ isra_push_node_to_stack (callee, to_ifs, &stack);
+ }
+ }
+ }
+ cycle_nodes.release ();
+ }
+
+ /* One sweep from callees to callers for parameter removal and splitting. */
+ for (int i = 0; i < node_scc_count; i++)
+ {
+ cgraph_node *scc_rep = order[i];
+ vec<cgraph_node *> cycle_nodes = ipa_get_nodes_in_cycle (scc_rep);
+
+ /* First step of parameter removal. */
+ for (cgraph_node *v : cycle_nodes)
+ {
+ isra_func_summary *ifs = func_sums->get (v);
+ if (!ifs || !ifs->m_candidate)
+ continue;
if (disable_unavailable_parameters (v, ifs))
continue;
for (cgraph_edge *cs = v->indirect_calls; cs; cs = cs->next_callee)
/* Look at edges within the current SCC and propagate used-ness across
them, pushing onto the stack all notes which might need to be
revisited. */
- FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ for (cgraph_node *v : cycle_nodes)
v->call_for_symbol_thunks_and_aliases (propagate_used_to_scc_callers,
&stack, true);
do
{
repeat_scc_access_propagation = false;
- FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ for (cgraph_node *v : cycle_nodes)
{
isra_func_summary *ifs = func_sums->get (v);
if (!ifs
while (repeat_scc_access_propagation);
if (flag_checking)
- FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ for (cgraph_node *v : cycle_nodes)
verify_splitting_accesses (v, true);
cycle_nodes.release ();
}
- /* One sweep from caller to callees for result removal. */
- for (int i = node_scc_count - 1; i >= 0 ; i--)
- {
- cgraph_node *scc_rep = order[i];
- vec<cgraph_node *> cycle_nodes = ipa_get_nodes_in_cycle (scc_rep);
- unsigned j;
-
- cgraph_node *v;
- FOR_EACH_VEC_ELT (cycle_nodes, j, v)
- {
- isra_func_summary *ifs = func_sums->get (v);
- if (!ifs || !ifs->m_candidate)
- continue;
-
- bool return_needed
- = (ifs->m_returns_value
- && (!dbg_cnt (ipa_sra_retvalues)
- || v->call_for_symbol_and_aliases (retval_used_p,
- NULL, true)));
- ifs->m_return_ignored = !return_needed;
- if (return_needed)
- isra_push_node_to_stack (v, ifs, &stack);
- }
-
- while (!stack.is_empty ())
- {
- cgraph_node *node = stack.pop ();
- isra_func_summary *ifs = func_sums->get (node);
- gcc_checking_assert (ifs && ifs->m_queued);
- ifs->m_queued = false;
-
- for (cgraph_edge *cs = node->callees; cs; cs = cs->next_callee)
- if (ipa_edge_within_scc (cs)
- && call_sums->get (cs)->m_return_returned)
- {
- enum availability av;
- cgraph_node *callee = cs->callee->function_symbol (&av);
- isra_func_summary *to_ifs = func_sums->get (callee);
- if (to_ifs && to_ifs->m_return_ignored)
- {
- to_ifs->m_return_ignored = false;
- isra_push_node_to_stack (callee, to_ifs, &stack);
- }
- }
- }
- cycle_nodes.release ();
- }
-
ipa_free_postorder_info ();
free (order);