This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, PR 42366] Stream ipa_node_params.uses_analysis_done flag
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 22 Dec 2009 20:04:25 +0100
- Subject: [PATCH, PR 42366] Stream ipa_node_params.uses_analysis_done flag
Hi,
the patch below fixes PR 42366. The problem is that
ipa_write_node_info asserts that parameter uses analysis has been
done, even though that is only performed when we do indirect inlining.
Because (if I understand it correctly) the consumer of the information
does not know the flags of the producer, I simply decided to output
the bit.
This however uncovered a segfault caused by the fact that we do not
create jump functions for calls where the number of formal parameters
is different from the actual ones if we also do not do indirect
inlining. Rather than changing the condition to "indirect inlining or
LTO" I have made it unconditional for the sake of simplicity (I guess
that doing ipa-cp and not doing indirect inlining is probably a very
uncommon situation). By the way, this situation takes place because
we seem to be unable to determine the number of parameters of builtin
functions. That is weird but I believe harmless so I didn't do
anything about it.
Bootstrapped and successfully regtested on x86_64-linux. It fixes the
testcase in bugzilla, and because Richi said he sees this a lot in the
testsuite already I did not bother to add a testcase. So, OK for
trunk?
Thanks,
Martin
2009-12-22 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42366
* ipa-cp.c (ipcp_init_stage): Always call ipa_compute_jump_functions on
edges with variable number of parameters.
* ipa-prop.c (ipa_write_node_info): Stream out uses_analysis_done
flag instead of asserting it.
(ipa_read_node_info): Read uses_analysis_done flag.
Index: icln/gcc/ipa-prop.c
===================================================================
--- icln.orig/gcc/ipa-prop.c
+++ icln/gcc/ipa-prop.c
@@ -2018,9 +2018,9 @@ ipa_write_node_info (struct output_block
bp = bitpack_create ();
bp_pack_value (bp, info->called_with_var_arguments, 1);
+ bp_pack_value (bp, info->uses_analysis_done, 1);
gcc_assert (info->modification_analysis_done
|| ipa_get_param_count (info) == 0);
- gcc_assert (info->uses_analysis_done || ipa_get_param_count (info) == 0);
gcc_assert (!info->node_enqueued);
gcc_assert (!info->ipcp_orig_node);
for (j = 0; j < ipa_get_param_count (info); j++)
@@ -2063,6 +2063,7 @@ ipa_read_node_info (struct lto_input_blo
bp = lto_input_bitpack (ib);
info->called_with_var_arguments = bp_unpack_value (bp, 1);
+ info->uses_analysis_done = bp_unpack_value (bp, 1);
if (ipa_get_param_count (info) != 0)
{
info->modification_analysis_done = true;
Index: icln/gcc/ipa-cp.c
===================================================================
--- icln.orig/gcc/ipa-cp.c
+++ icln/gcc/ipa-cp.c
@@ -633,15 +633,8 @@ ipcp_init_stage (void)
ipa_count_arguments (cs);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
- {
- /* Handle cases of functions with
- a variable number of parameters. */
- ipa_set_called_with_variable_arg (IPA_NODE_REF (cs->callee));
- if (flag_indirect_inlining)
- ipa_compute_jump_functions (cs);
- }
- else
- ipa_compute_jump_functions (cs);
+ ipa_set_called_with_variable_arg (IPA_NODE_REF (cs->callee));
+ ipa_compute_jump_functions (cs);
}
}
}