From 9600efe1a6c42b8acf7449561760c36968155f83 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 19 Aug 2009 14:29:52 +0000 Subject: [PATCH] omp-low.c (optimize_omp_library_calls): Use types_compatible_p instead of comparing TYPE_MAIN_VARIANT for equality. * 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. From-SVN: r150936 --- gcc/ChangeLog | 10 ++++++++++ gcc/gimplify.c | 10 ++-------- gcc/omp-low.c | 4 ++-- gcc/tree-vect-loop.c | 8 ++++---- gcc/tree-vect-patterns.c | 22 ++++++++++------------ 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9df0297b0c6..855e4e50926 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2009-08-18 Michael Matz + + * 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 * tree-ssa-structalias.c (create_variable_info_for): Also mark diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7de2a7e183f..3ba40a88f19 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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); diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 087f6fc42f4..a7de367e432 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -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); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index b322213f108..83833b137fa 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -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)) { diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 1971e6ad4d3..3a77e858a57 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -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,