diff mbox

Fix TYPE_MAIN_VARIANT made by ipa-prop

Message ID 20140925221453.GA2065@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Sept. 25, 2014, 10:14 p.m. UTC
Hi,
according to my type checker, ipa-prop is only place where we produce a variant of
a METHOD_TYPE that is FUNCTION_TYPE or viarant that has different parameters.

The code in question is producing new prototype to remove unused arguments,
but I do not think it should eclare the new type to be variant of the original.

Historically I think I introduced the code because I simply copied what linker
does without caring too much about the consequences.

Bootstrapped/regtested x86_64-linux, OK?

	* ipa-prop.c (ipa_modify_formal_parameters): Do not declare new type
	to be variant of original type.

Comments

Richard Biener Sept. 26, 2014, 8:35 a.m. UTC | #1
On Fri, Sep 26, 2014 at 12:14 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> according to my type checker, ipa-prop is only place where we produce a variant of
> a METHOD_TYPE that is FUNCTION_TYPE or viarant that has different parameters.
>
> The code in question is producing new prototype to remove unused arguments,
> but I do not think it should eclare the new type to be variant of the original.
>
> Historically I think I introduced the code because I simply copied what linker
> does without caring too much about the consequences.

I agree.

> Bootstrapped/regtested x86_64-linux, OK?

Yes.

Thanks,
Richard.

>         * ipa-prop.c (ipa_modify_formal_parameters): Do not declare new type
>         to be variant of original type.
>
> Index: ipa-prop.c
> ===================================================================
> --- ipa-prop.c  (revision 215615)
> +++ ipa-prop.c  (working copy)
> @@ -3990,21 +3990,6 @@
>        DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
>      }
>
> -  /* This is a new type, not a copy of an old type.  Need to reassociate
> -     variants.  We can handle everything except the main variant lazily.  */
> -  tree t = TYPE_MAIN_VARIANT (orig_type);
> -  if (orig_type != t)
> -    {
> -      TYPE_MAIN_VARIANT (new_type) = t;
> -      TYPE_NEXT_VARIANT (new_type) = TYPE_NEXT_VARIANT (t);
> -      TYPE_NEXT_VARIANT (t) = new_type;
> -    }
> -  else
> -    {
> -      TYPE_MAIN_VARIANT (new_type) = new_type;
> -      TYPE_NEXT_VARIANT (new_type) = NULL;
> -    }
> -
>    TREE_TYPE (fndecl) = new_type;
>    DECL_VIRTUAL_P (fndecl) = 0;
>    DECL_LANG_SPECIFIC (fndecl) = NULL;
diff mbox

Patch

Index: ipa-prop.c
===================================================================
--- ipa-prop.c	(revision 215615)
+++ ipa-prop.c	(working copy)
@@ -3990,21 +3990,6 @@ 
       DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
     }
 
-  /* This is a new type, not a copy of an old type.  Need to reassociate
-     variants.  We can handle everything except the main variant lazily.  */
-  tree t = TYPE_MAIN_VARIANT (orig_type);
-  if (orig_type != t)
-    {
-      TYPE_MAIN_VARIANT (new_type) = t;
-      TYPE_NEXT_VARIANT (new_type) = TYPE_NEXT_VARIANT (t);
-      TYPE_NEXT_VARIANT (t) = new_type;
-    }
-  else
-    {
-      TYPE_MAIN_VARIANT (new_type) = new_type;
-      TYPE_NEXT_VARIANT (new_type) = NULL;
-    }
-
   TREE_TYPE (fndecl) = new_type;
   DECL_VIRTUAL_P (fndecl) = 0;
   DECL_LANG_SPECIFIC (fndecl) = NULL;