[tree-ssa] Improve type checking in dominator opts

law@redhat.com law@redhat.com
Tue Jul 15 19:35:00 GMT 2003


This fixes 4 failures in the tree-ssa tests by realizing that two types
are equivalent for redundancy elimination purposes if their TYPE_MAIN_VARIANTS
are the same.

	* tree-ssa-dom.c (optimize_stmt): Consider two types equivalent if
	their TYPE_MAIN_VARIANT is equivalent.
	(avail_expr_eq): Likewise.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.1
diff -c -3 -p -r1.1.2.1 tree-ssa-dom.c
*** tree-ssa-dom.c	15 Jul 2003 19:15:25 -0000	1.1.2.1
--- tree-ssa-dom.c	15 Jul 2003 19:29:31 -0000
*************** optimize_stmt (block_stmt_iterator si, v
*** 421,427 ****
  					   block_avail_exprs_p,
  					   const_and_copies);
        opt_stats.num_exprs_considered++;
!       if (cached_lhs && TREE_TYPE (cached_lhs) == TREE_TYPE (*def_p))
  	{
  	  if (dump_file && (dump_flags & TDF_DETAILS))
  	    {
--- 421,430 ----
  					   block_avail_exprs_p,
  					   const_and_copies);
        opt_stats.num_exprs_considered++;
!       if (cached_lhs
! 	  && (TREE_TYPE (cached_lhs) == TREE_TYPE (*def_p)
! 	      || (TYPE_MAIN_VARIANT (TREE_TYPE (cached_lhs))
! 		  == TYPE_MAIN_VARIANT (TREE_TYPE (*def_p)))))
  	{
  	  if (dump_file && (dump_flags & TDF_DETAILS))
  	    {
*************** avail_expr_eq (const void *p1, const voi
*** 652,658 ****
    /* In case of a collision, both RHS have to be identical and have the
       same VUSE operands.  */
    if (TREE_CODE (rhs1) == TREE_CODE (rhs2)
!       && TREE_TYPE (rhs1) == TREE_TYPE (rhs2)
        && operand_equal_p (rhs1, rhs2, 0))
      {
        varray_type ops1 = vuse_ops (s1);
--- 655,663 ----
    /* In case of a collision, both RHS have to be identical and have the
       same VUSE operands.  */
    if (TREE_CODE (rhs1) == TREE_CODE (rhs2)
!       && (TREE_TYPE (rhs1) == TREE_TYPE (rhs2)
! 	  || (TYPE_MAIN_VARIANT (TREE_TYPE (rhs1))
! 	      == TYPE_MAIN_VARIANT (TREE_TYPE (rhs2))))
        && operand_equal_p (rhs1, rhs2, 0))
      {
        varray_type ops1 = vuse_ops (s1);








More information about the Gcc-patches mailing list