diff mbox

[PR,60266] Fix problem with mixing -O0 and -O2 in propagate_constants_accross_call

Message ID 20140221144002.GB26239@virgil.suse
State New
Headers show

Commit Message

Martin Jambor Feb. 21, 2014, 2:40 p.m. UTC
Hi,

in propagate_constants_accross_call we expect a thunk to have at least
one parameter and thus an ipa-prop parameter descriptor.  However,
when the callee comes from a CU that was compiled with -O0, there are
no parameter descriptors and we fail an index checking assert.

This patch fixes it by bailing out early if there are no parameter
descriptors because in that case there is nothing to do in that
function anyway.  Bootstrap and testing in progress, OK for trunk if
it passes?

Thanks,

Martin


2014-02-21  Martin Jambor  <mjambor@suse.cz>

	PR ipa/60266
	* ipa-cp.c (propagate_constants_accross_call): Bail out early if
	there are no parameter descriptors.

Comments

Jan Hubicka Feb. 21, 2014, 5:28 p.m. UTC | #1
> Hi,
> 
> in propagate_constants_accross_call we expect a thunk to have at least
> one parameter and thus an ipa-prop parameter descriptor.  However,
> when the callee comes from a CU that was compiled with -O0, there are
> no parameter descriptors and we fail an index checking assert.
> 
> This patch fixes it by bailing out early if there are no parameter
> descriptors because in that case there is nothing to do in that
> function anyway.  Bootstrap and testing in progress, OK for trunk if
> it passes?
> 
> Thanks,
> 
> Martin
> 
> 
> 2014-02-21  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/60266
> 	* ipa-cp.c (propagate_constants_accross_call): Bail out early if
> 	there are no parameter descriptors.

Actually I have similar patch in my tree for few days since I hit the problem
while building libreoffice.

OK.
Honza
> 
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 7d8bc05..4c9ab12 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -1428,6 +1428,8 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
>    args = IPA_EDGE_REF (cs);
>    args_count = ipa_get_cs_argument_count (args);
>    parms_count = ipa_get_param_count (callee_info);
> +  if (parms_count == 0)
> +    return false;
>  
>    /* If this call goes through a thunk we must not propagate to the first (0th)
>       parameter.  However, we might need to uncover a thunk from below a series
diff mbox

Patch

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 7d8bc05..4c9ab12 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1428,6 +1428,8 @@  propagate_constants_accross_call (struct cgraph_edge *cs)
   args = IPA_EDGE_REF (cs);
   args_count = ipa_get_cs_argument_count (args);
   parms_count = ipa_get_param_count (callee_info);
+  if (parms_count == 0)
+    return false;
 
   /* If this call goes through a thunk we must not propagate to the first (0th)
      parameter.  However, we might need to uncover a thunk from below a series