* omp-low.c (optimize_omp_library_calls): Use types_compatible_p
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Aug 2009 14:29:52 +0000 (14:29 +0000)
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Aug 2009 14:29:52 +0000 (14:29 +0000)
        instead of comparing TYPE_MAIN_VARIANT for equality.
        * tree-vect-patterns.c (vect_recog_dot_prod_pattern,
        vect_recog_widen_mult_pattern, vect_recog_widen_sum_pattern): Ditto.
        * tree-vect-loop.c (vect_is_simple_reduction): Ditto.
        * gimplify.c (goa_lhs_expr_p): Ditto and use
        STRIP_USELESS_TYPE_CONVERSION.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150936 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimplify.c
gcc/omp-low.c
gcc/tree-vect-loop.c
gcc/tree-vect-patterns.c

index 9df0297..855e4e5 100644 (file)
@@ -1,5 +1,15 @@
 2009-08-18  Michael Matz  <matz@suse.de>
 
+       * omp-low.c (optimize_omp_library_calls): Use types_compatible_p
+       instead of comparing TYPE_MAIN_VARIANT for equality.
+       * tree-vect-patterns.c (vect_recog_dot_prod_pattern,
+       vect_recog_widen_mult_pattern, vect_recog_widen_sum_pattern): Ditto.
+       * tree-vect-loop.c (vect_is_simple_reduction): Ditto.
+       * gimplify.c (goa_lhs_expr_p): Ditto and use
+       STRIP_USELESS_TYPE_CONVERSION.
+
+2009-08-18  Michael Matz  <matz@suse.de>
+
        * tree-ssa-structalias.c (create_variable_info_for): Also mark
        first field in a struct.
        (intra_create_variable_infos): Don't deal with flag_argument_noalias.
index 7de2a7e..3ba40a8 100644 (file)
@@ -6152,12 +6152,7 @@ goa_lhs_expr_p (tree expr, tree addr)
   /* Also include casts to other type variants.  The C front end is fond
      of adding these for e.g. volatile variables.  This is like 
      STRIP_TYPE_NOPS but includes the main variant lookup.  */
-  while ((CONVERT_EXPR_P (expr)
-          || TREE_CODE (expr) == NON_LVALUE_EXPR)
-         && TREE_OPERAND (expr, 0) != error_mark_node
-         && (TYPE_MAIN_VARIANT (TREE_TYPE (expr))
-             == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (expr, 0)))))
-    expr = TREE_OPERAND (expr, 0);
+  STRIP_USELESS_TYPE_CONVERSION (expr);
 
   if (TREE_CODE (expr) == INDIRECT_REF)
     {
@@ -6166,8 +6161,7 @@ goa_lhs_expr_p (tree expr, tree addr)
             && (CONVERT_EXPR_P (expr)
                 || TREE_CODE (expr) == NON_LVALUE_EXPR)
             && TREE_CODE (expr) == TREE_CODE (addr)
-            && TYPE_MAIN_VARIANT (TREE_TYPE (expr))
-               == TYPE_MAIN_VARIANT (TREE_TYPE (addr)))
+            && types_compatible_p (TREE_TYPE (expr), TREE_TYPE (addr)))
        {
          expr = TREE_OPERAND (expr, 0);
          addr = TREE_OPERAND (addr, 0);
index 087f6fc..a7de367 100644 (file)
@@ -3316,8 +3316,8 @@ optimize_omp_library_calls (gimple entry_stmt)
              continue;
 
            if (TREE_CODE (TREE_TYPE (decl)) != FUNCTION_TYPE
-               || TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl)))
-                  != TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (built_in))))
+               || !types_compatible_p (TREE_TYPE (TREE_TYPE (decl)),
+                                       TREE_TYPE (TREE_TYPE (built_in))))
              continue;
 
            gimple_call_set_fndecl (call, built_in);
index b322213..83833b1 100644 (file)
@@ -1739,13 +1739,13 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi,
 
   type = TREE_TYPE (gimple_assign_lhs (def_stmt));
   if ((TREE_CODE (op1) == SSA_NAME
-       && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op1)))
+       && !types_compatible_p (type,TREE_TYPE (op1)))
       || (TREE_CODE (op2) == SSA_NAME
-          && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op2)))
+          && !types_compatible_p (type, TREE_TYPE (op2)))
       || (op3 && TREE_CODE (op3) == SSA_NAME
-          && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op3)))
+          && !types_compatible_p (type, TREE_TYPE (op3)))
       || (op4 && TREE_CODE (op4) == SSA_NAME
-          && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (TREE_TYPE (op4))))
+          && !types_compatible_p (type, TREE_TYPE (op4))))
     {
       if (vect_print_dump_info (REPORT_DETAILS))
         {
index 1971e6a..3a77e85 100644 (file)
@@ -233,8 +233,8 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
         return NULL;
       oprnd0 = gimple_assign_rhs1 (last_stmt);
       oprnd1 = gimple_assign_rhs2 (last_stmt);
-      if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
-          || TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
+      if (!types_compatible_p (TREE_TYPE (oprnd0), type)
+         || !types_compatible_p (TREE_TYPE (oprnd1), type))
         return NULL;
       stmt = last_stmt;
 
@@ -285,10 +285,8 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
 
       oprnd0 = gimple_assign_rhs1 (stmt);
       oprnd1 = gimple_assign_rhs2 (stmt);
-      if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) 
-                               != TYPE_MAIN_VARIANT (prod_type)
-          || TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) 
-                               != TYPE_MAIN_VARIANT (prod_type))
+      if (!types_compatible_p (TREE_TYPE (oprnd0), prod_type)
+          || !types_compatible_p (TREE_TYPE (oprnd1), prod_type))
         return NULL;
       if (!widened_name_p (oprnd0, stmt, &half_type0, &def_stmt))
         return NULL;
@@ -296,7 +294,7 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
       if (!widened_name_p (oprnd1, stmt, &half_type1, &def_stmt))
         return NULL;
       oprnd01 = gimple_assign_rhs1 (def_stmt);
-      if (TYPE_MAIN_VARIANT (half_type0) != TYPE_MAIN_VARIANT (half_type1))
+      if (!types_compatible_p (half_type0, half_type1))
         return NULL;
       if (TYPE_PRECISION (prod_type) != TYPE_PRECISION (half_type0) * 2)
        return NULL;
@@ -384,8 +382,8 @@ vect_recog_widen_mult_pattern (gimple last_stmt,
 
   oprnd0 = gimple_assign_rhs1 (last_stmt);
   oprnd1 = gimple_assign_rhs2 (last_stmt);
-  if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
-      || TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
+  if (!types_compatible_p (TREE_TYPE (oprnd0), type)
+      || !types_compatible_p (TREE_TYPE (oprnd1), type))
     return NULL;
 
   /* Check argument 0 */
@@ -398,7 +396,7 @@ vect_recog_widen_mult_pattern (gimple last_stmt,
     return NULL;
   oprnd1 = gimple_assign_rhs1 (def_stmt1);
 
-  if (TYPE_MAIN_VARIANT (half_type0) != TYPE_MAIN_VARIANT (half_type1))
+  if (!types_compatible_p (half_type0, half_type1))
     return NULL;
 
   /* Pattern detected.  */
@@ -602,8 +600,8 @@ vect_recog_widen_sum_pattern (gimple last_stmt, tree *type_in, tree *type_out)
 
   oprnd0 = gimple_assign_rhs1 (last_stmt);
   oprnd1 = gimple_assign_rhs2 (last_stmt);
-  if (TYPE_MAIN_VARIANT (TREE_TYPE (oprnd0)) != TYPE_MAIN_VARIANT (type)
-      || TYPE_MAIN_VARIANT (TREE_TYPE (oprnd1)) != TYPE_MAIN_VARIANT (type))
+  if (!types_compatible_p (TREE_TYPE (oprnd0), type)
+      || !types_compatible_p (TREE_TYPE (oprnd1), type))
     return NULL;
 
   /* So far so good. Since last_stmt was detected as a (summation) reduction,