This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR45013


This fixes PR45013 by restricting the new compatibility check to LTO
mode.  At the same time it should speed up comparisons by using
the commonized canonical type during the compare which should save
hash table lookups to the comparison cache.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2010-07-21  Richard Guenther  <rguenther@suse.de>

	PR middle-end/45013
	* tree-ssa.c (useless_type_conversion_p): Dispatch to
	gimple_types_compatible_p only when in lto.
	* gimple.c (gimple_types_compatible_p): Use canonical types
	to speed up comparison.

Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c	(revision 162368)
--- gcc/tree-ssa.c	(working copy)
*************** useless_type_conversion_p (tree outer_ty
*** 1426,1432 ****
       compared types.  */
    else if (AGGREGATE_TYPE_P (inner_type)
  	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
!     return gimple_types_compatible_p (outer_type, inner_type, false);
  
    return false;
  }
--- 1426,1433 ----
       compared types.  */
    else if (AGGREGATE_TYPE_P (inner_type)
  	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
!     return (in_lto_p
! 	    && gimple_types_compatible_p (outer_type, inner_type, false));
  
    return false;
  }
Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c	(revision 162368)
--- gcc/gimple.c	(working copy)
*************** gimple_types_compatible_p (tree t1, tree
*** 3360,3365 ****
--- 3362,3373 ----
    if (t1 == NULL_TREE || t2 == NULL_TREE)
      return 0;
  
+   /* If the types have been previously registered and found equal
+      they still are.  */
+   if (TYPE_CANONICAL (t1)
+       && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2))
+     return 1;
+ 
    /* Can't be the same type if the types don't have the same code.  */
    if (TREE_CODE (t1) != TREE_CODE (t2))
      return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]