Patchwork [PR,45934,3/6] More robust compute_complex_ancestor_jump_func

login
register
mail settings
Submitter Martin Jambor
Date Dec. 1, 2010, 8:16 p.m.
Message ID <20101201201711.029187216@virgil.suse.cz>
Download mbox | patch
Permalink /patch/73902/
State New
Headers show

Comments

Martin Jambor - Dec. 1, 2010, 8:16 p.m.
Hi,

compute_complex_ancestor_jump_func tries to match a pattern like this:

     if (obj_2(D) != 0B)
       goto <bb 3>;
     else
       goto <bb 4>;

   <bb 3>:
     iftmp.1_3 = &obj_2(D)->D.1762;

   <bb 4>:
     # iftmp.1_1 = PHI <iftmp.1_3(3), 0B(2)>
     D.1879_6 = middleman_1 (iftmp.1_1, i_5(D));
     return D.1879_6;  */

At some point while working at the devirtualization issues I have seen
this failing because the zero was the zeroth parameter in the phi
node.  I think it is necessary for some of the new testcases to work
but I am not really sure any more, I only remembered when I was
splitting the big patch into separate ones.

I did not bootstrap this patch separately but it did pas bootstrap and
testsuite on x86_64-linux and make check-c++ on i686 together with the
rest.

Thanks,

Martin


2010-11-30  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (compute_complex_ancestor_jump_func): Work also if the
	zero is the first phi parameter.
Richard Guenther - Dec. 1, 2010, 8:28 p.m.
On Wed, Dec 1, 2010 at 9:16 PM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> compute_complex_ancestor_jump_func tries to match a pattern like this:
>
>     if (obj_2(D) != 0B)
>       goto <bb 3>;
>     else
>       goto <bb 4>;
>
>   <bb 3>:
>     iftmp.1_3 = &obj_2(D)->D.1762;
>
>   <bb 4>:
>     # iftmp.1_1 = PHI <iftmp.1_3(3), 0B(2)>
>     D.1879_6 = middleman_1 (iftmp.1_1, i_5(D));
>     return D.1879_6;  */
>
> At some point while working at the devirtualization issues I have seen
> this failing because the zero was the zeroth parameter in the phi
> node.  I think it is necessary for some of the new testcases to work
> but I am not really sure any more, I only remembered when I was
> splitting the big patch into separate ones.
>
> I did not bootstrap this patch separately but it did pas bootstrap and
> testsuite on x86_64-linux and make check-c++ on i686 together with the
> rest.

Ok.

Thanks,
Richard.

> Thanks,
>
> Martin
>
>
> 2010-11-30  Martin Jambor  <mjambor@suse.cz>
>
>        * ipa-prop.c (compute_complex_ancestor_jump_func): Work also if the
>        zero is the first phi parameter.
>
> Index: icln/gcc/ipa-prop.c
> ===================================================================
> --- icln.orig/gcc/ipa-prop.c
> +++ icln/gcc/ipa-prop.c
> @@ -461,11 +461,15 @@ compute_complex_ancestor_jump_func (stru
>   tree tmp, parm, expr;
>   int index, i;
>
> -  if (gimple_phi_num_args (phi) != 2
> -      || !integer_zerop (PHI_ARG_DEF (phi, 1)))
> +  if (gimple_phi_num_args (phi) != 2)
>     return;
>
> -  tmp = PHI_ARG_DEF (phi, 0);
> +  if (integer_zerop (PHI_ARG_DEF (phi, 1)))
> +    tmp = PHI_ARG_DEF (phi, 0);
> +  else if (integer_zerop (PHI_ARG_DEF (phi, 0)))
> +    tmp = PHI_ARG_DEF (phi, 1);
> +  else
> +    return;
>   if (TREE_CODE (tmp) != SSA_NAME
>       || SSA_NAME_IS_DEFAULT_DEF (tmp)
>       || !POINTER_TYPE_P (TREE_TYPE (tmp))
>
>

Patch

Index: icln/gcc/ipa-prop.c
===================================================================
--- icln.orig/gcc/ipa-prop.c
+++ icln/gcc/ipa-prop.c
@@ -461,11 +461,15 @@  compute_complex_ancestor_jump_func (stru
   tree tmp, parm, expr;
   int index, i;
 
-  if (gimple_phi_num_args (phi) != 2
-      || !integer_zerop (PHI_ARG_DEF (phi, 1)))
+  if (gimple_phi_num_args (phi) != 2)
     return;
 
-  tmp = PHI_ARG_DEF (phi, 0);
+  if (integer_zerop (PHI_ARG_DEF (phi, 1)))
+    tmp = PHI_ARG_DEF (phi, 0);
+  else if (integer_zerop (PHI_ARG_DEF (phi, 0)))
+    tmp = PHI_ARG_DEF (phi, 1);
+  else
+    return;
   if (TREE_CODE (tmp) != SSA_NAME
       || SSA_NAME_IS_DEFAULT_DEF (tmp)
       || !POINTER_TYPE_P (TREE_TYPE (tmp))