builtins.c (fold_builtin_atomic_always_lock_free): Use CONVERT_EXPR_P, CONVERT_EXPR_C...
authorRichard Biener <rguenther@suse.de>
Fri, 31 Oct 2014 16:26:43 +0000 (16:26 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 31 Oct 2014 16:26:43 +0000 (16:26 +0000)
2014-10-31  Richard Biener  <rguenther@suse.de>

* builtins.c (fold_builtin_atomic_always_lock_free): Use
CONVERT_EXPR_P, CONVERT_EXPR_CODE_P and CASE_CONVERT where
approprate.
(fold_builtin_expect): Likewise.
(integer_valued_real_p): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* ipa-inline-analysis.c (eliminated_by_inlining_prob): Likewise.
(find_foldable_builtin_expect): Likewise.
* trans-mem.c (thread_private_new_memory): Likewise.
* tree-affine.c (aff_combination_expand): Likewise.
* tree-data-ref.c (initialize_matrix_A): Likewise.
* tree-inline.c (copy_bb): Likewise.
* tree-pretty-print.c (dump_function_name): Likewise.
(print_call_name): Likewise.
* tree-ssa-forwprop.c (constant_pointer_difference): Likewise.
* tree-ssa-math-opts.c (find_bswap_or_nop_1): Likewise.
* tree-vect-generic.c (expand_vector_operations_1): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const): Likewise.
(vect_recog_widen_mult_pattern): Likewise.
(vect_operation_fits_smaller_type): Likewise.
* tree-vrp.c (find_assert_locations_1): Likewise.
* tree-ssa-dom.c (initialize_hash_element): Canonicalize
converts to NOP_EXPR.

From-SVN: r216982

15 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/cfgexpand.c
gcc/ipa-inline-analysis.c
gcc/trans-mem.c
gcc/tree-affine.c
gcc/tree-data-ref.c
gcc/tree-inline.c
gcc/tree-pretty-print.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-forwprop.c
gcc/tree-ssa-math-opts.c
gcc/tree-vect-generic.c
gcc/tree-vect-patterns.c
gcc/tree-vrp.c

index 561a8765b3ad0b69715253fe9ad4dc49e808d3d5..2d6824d8d53eb76c28422d24e02392bee7a34465 100644 (file)
@@ -1,3 +1,29 @@
+2014-10-31  Richard Biener  <rguenther@suse.de>
+
+       * builtins.c (fold_builtin_atomic_always_lock_free): Use
+       CONVERT_EXPR_P, CONVERT_EXPR_CODE_P and CASE_CONVERT where
+       approprate.
+       (fold_builtin_expect): Likewise.
+       (integer_valued_real_p): Likewise.
+       * cfgexpand.c (expand_debug_expr): Likewise.
+       * ipa-inline-analysis.c (eliminated_by_inlining_prob): Likewise.
+       (find_foldable_builtin_expect): Likewise.
+       * trans-mem.c (thread_private_new_memory): Likewise.
+       * tree-affine.c (aff_combination_expand): Likewise.
+       * tree-data-ref.c (initialize_matrix_A): Likewise.
+       * tree-inline.c (copy_bb): Likewise.
+       * tree-pretty-print.c (dump_function_name): Likewise.
+       (print_call_name): Likewise.
+       * tree-ssa-forwprop.c (constant_pointer_difference): Likewise.
+       * tree-ssa-math-opts.c (find_bswap_or_nop_1): Likewise.
+       * tree-vect-generic.c (expand_vector_operations_1): Likewise.
+       * tree-vect-patterns.c (vect_handle_widen_op_by_const): Likewise.
+       (vect_recog_widen_mult_pattern): Likewise.
+       (vect_operation_fits_smaller_type): Likewise.
+       * tree-vrp.c (find_assert_locations_1): Likewise.
+       * tree-ssa-dom.c (initialize_hash_element): Canonicalize
+       converts to NOP_EXPR.
+
 2014-10-31  Richard Biener  <rguenther@suse.de>
 
        * genmatch.c (expr::gen_transform): Use NOP_EXPRs instead of
index dd0869d366f2cfc2da0afd202be7d63c00dd2fac..ad3a84e1b762e67b6425fc0d566d7d5f559546fe 100644 (file)
@@ -5551,7 +5551,7 @@ fold_builtin_atomic_always_lock_free (tree arg0, tree arg1)
         end before anything else has a chance to look at it.  The pointer
         parameter at this point is usually cast to a void *, so check for that
         and look past the cast.  */
-      if (TREE_CODE (arg1) == NOP_EXPR && POINTER_TYPE_P (ttype)
+      if (CONVERT_EXPR_P (arg1) && POINTER_TYPE_P (ttype)
          && VOID_TYPE_P (TREE_TYPE (ttype)))
        arg1 = TREE_OPERAND (arg1, 0);
 
@@ -6989,7 +6989,7 @@ fold_builtin_expect (location_t loc, tree arg0, tree arg1, tree arg2)
   /* Distribute the expected value over short-circuiting operators.
      See through the cast from truthvalue_type_node to long.  */
   inner_arg0 = arg0;
-  while (TREE_CODE (inner_arg0) == NOP_EXPR
+  while (CONVERT_EXPR_P (inner_arg0)
         && INTEGRAL_TYPE_P (TREE_TYPE (inner_arg0))
         && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (inner_arg0, 0))))
     inner_arg0 = TREE_OPERAND (inner_arg0, 0);
@@ -7155,7 +7155,7 @@ integer_valued_real_p (tree t)
     case REAL_CST:
       return real_isinteger (TREE_REAL_CST_PTR (t), TYPE_MODE (TREE_TYPE (t)));
 
-    case NOP_EXPR:
+    CASE_CONVERT:
       {
        tree type = TREE_TYPE (TREE_OPERAND (t, 0));
        if (TREE_CODE (type) == INTEGER_TYPE)
index 9bd61359e80fb4f878c2ba0c7c4f82534583fe5c..05827690ab4b59668e4d66caef84254c12e2d98e 100644 (file)
@@ -3882,8 +3882,7 @@ expand_debug_expr (tree exp)
 
     adjust_mode:
     case PAREN_EXPR:
-    case NOP_EXPR:
-    case CONVERT_EXPR:
+    CASE_CONVERT:
       {
        inner_mode = GET_MODE (op0);
 
index 68b9de07eb97faf6c3e197254931faaac991b878..eb1c6ec2d0def83313c10a989b5b812bcf57b5ac 100644 (file)
@@ -1617,8 +1617,7 @@ eliminated_by_inlining_prob (gimple stmt)
          and stores to return value or parameters are often free after
          inlining dua to SRA and further combining.
          Assume that half of statements goes away.  */
-      if (rhs_code == CONVERT_EXPR
-         || rhs_code == NOP_EXPR
+      if (CONVERT_EXPR_CODE_P (rhs_code)
          || rhs_code == VIEW_CONVERT_EXPR
          || rhs_code == ADDR_EXPR
          || gimple_assign_rhs_class (stmt) == GIMPLE_SINGLE_RHS)
@@ -2377,7 +2376,7 @@ find_foldable_builtin_expect (basic_block bb)
                     match = true;
                     done = true;
                     break;
-                  case NOP_EXPR:
+                  CASE_CONVERT:
                     break;
                   default:
                     done = true;
index 4f451c51478142d82d202f063022882003c05671..9899e7b54a89fa6637285c6cf524c6c4a6e1b2b5 100644 (file)
@@ -1415,7 +1415,7 @@ thread_private_new_memory (basic_block entry_block, tree x)
          else if (code == POINTER_PLUS_EXPR)
            x = gimple_assign_rhs1 (stmt);
          /* x = (cast*) foo ==> foo */
-         else if (code == VIEW_CONVERT_EXPR || code == NOP_EXPR)
+         else if (code == VIEW_CONVERT_EXPR || CONVERT_EXPR_CODE_P (code))
            x = gimple_assign_rhs1 (stmt);
          /* x = c ? op1 : op2 == > op1 or op2 just like a PHI */
          else if (code == COND_EXPR)
index f16ef6ab4e753345e17c7afa010061bb400f2392..7a0b89edf71f3188a1a535ef0ef853618b6f6d88 100644 (file)
@@ -648,7 +648,7 @@ aff_combination_expand (aff_tree *comb ATTRIBUTE_UNUSED,
       type = TREE_TYPE (e);
       name = e;
       /* Look through some conversions.  */
-      if (TREE_CODE (e) == NOP_EXPR
+      if (CONVERT_EXPR_P (e)
           && (TYPE_PRECISION (type)
              >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (e, 0)))))
        name = TREE_OPERAND (e, 0);
index dd367057139d82830da5daba7b3f3c6bc5a7bb5e..4eac19297e5d1948ce873bae173f2bf10e3205f1 100644 (file)
@@ -2100,7 +2100,7 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
        return chrec_fold_op (TREE_CODE (chrec), chrec_type (chrec), op0, op1);
       }
 
-    case NOP_EXPR:
+    CASE_CONVERT:
       {
        tree op = initialize_matrix_A (A, TREE_OPERAND (chrec, 0), index, mult);
        return chrec_convert (chrec_type (chrec), op, NULL);
index 2025b384b7fc6e2c4fa228d82d1c8c1aacb257f6..bf130d1824bcd9012c7f0215da131c155f4210b9 100644 (file)
@@ -1686,7 +1686,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
       /* With return slot optimization we can end up with
         non-gimple (foo *)&this->m, fix that here.  */
       if (is_gimple_assign (stmt)
-         && gimple_assign_rhs_code (stmt) == NOP_EXPR
+         && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
          && !is_gimple_val (gimple_assign_rhs1 (stmt)))
        {
          tree new_rhs;
index bafdc5c70d6b07b4cff21c4d05fc23b4059be2ca..2211309ebb7c5e094a2bfcce60ebc7f325082505 100644 (file)
@@ -225,7 +225,7 @@ dump_decl_name (pretty_printer *buffer, tree node, int flags)
 static void
 dump_function_name (pretty_printer *buffer, tree node, int flags)
 {
-  if (TREE_CODE (node) == NOP_EXPR)
+  if (CONVERT_EXPR_P (node))
     node = TREE_OPERAND (node, 0);
   if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
     pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
@@ -3266,7 +3266,7 @@ print_call_name (pretty_printer *buffer, tree node, int flags)
 
     case ADDR_EXPR:
     case INDIRECT_REF:
-    case NOP_EXPR:
+    CASE_CONVERT:
       op0 = TREE_OPERAND (op0, 0);
       goto again;
 
index 6fa0dc6b1063e4c2a72411e93e068d75fd96fdf6..191d3e0c14664b6a6c2fe396fd736372775da5f4 100644 (file)
@@ -306,7 +306,7 @@ initialize_hash_element (gimple stmt, tree lhs,
          expr->kind = EXPR_UNARY;
          expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
          if (CONVERT_EXPR_CODE_P (subcode))
-           subcode = CONVERT_EXPR;
+           subcode = NOP_EXPR;
          expr->ops.unary.op = subcode;
          expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
          break;
index d67a4b648afc9b4869ed7860a3b99fc7b3ebe346..3267bb9a3db03097fa179528ff3cd2556d1333f8 100644 (file)
@@ -1487,7 +1487,7 @@ constant_pointer_difference (tree p1, tree p2)
              off = size_binop (PLUS_EXPR, off, gimple_assign_rhs2 (stmt));
              p = gimple_assign_rhs1 (stmt);
            }
-         else if (code == ADDR_EXPR || code == NOP_EXPR)
+         else if (code == ADDR_EXPR || CONVERT_EXPR_CODE_P (code))
            p = gimple_assign_rhs1 (stmt);
          else
            break;
index 27825895a272a4309e12dcbfa4ffe440a124b833..295e2b5610188b1c069fd04b20e6bbdb7d18921a 100644 (file)
@@ -1867,8 +1867,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
          && code != RSHIFT_EXPR
          && code != LROTATE_EXPR
          && code != RROTATE_EXPR
-         && code != NOP_EXPR
-         && code != CONVERT_EXPR)
+         && !CONVERT_EXPR_CODE_P (code))
        return NULL;
 
       source_stmt1 = find_bswap_or_nop_1 (rhs1_stmt, n, limit - 1);
index 155b64d44270721ae182c2faf72a6038e13374c9..d9445a4fb66f61c2a0254cb10f16516285c70e5e 100644 (file)
@@ -1449,14 +1449,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
   if (TREE_CODE (type) != VECTOR_TYPE)
     return;
 
-  if (code == NOP_EXPR
+  if (CONVERT_EXPR_CODE_P (code)
       || code == FLOAT_EXPR
       || code == FIX_TRUNC_EXPR
       || code == VIEW_CONVERT_EXPR)
     return;
 
-  gcc_assert (code != CONVERT_EXPR);
-
   /* The signedness is determined from input argument.  */
   if (code == VEC_UNPACK_FLOAT_HI_EXPR
       || code == VEC_UNPACK_FLOAT_LO_EXPR)
index b3c07b6f24a27c038d13ef180a3f54662aae03cb..8478dfcb7150c7e01f6879d55d699c7cc3f888bf 100644 (file)
@@ -747,7 +747,7 @@ vect_handle_widen_op_by_const (gimple stmt, enum tree_code code,
       new_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt));
       /* Check if the already created pattern stmt is what we need.  */
       if (!is_gimple_assign (new_stmt)
-          || gimple_assign_rhs_code (new_stmt) != NOP_EXPR
+          || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (new_stmt))
           || TREE_TYPE (gimple_assign_lhs (new_stmt)) != new_type)
         return false;
 
@@ -952,7 +952,7 @@ vect_recog_widen_mult_pattern (vec<gimple> *stmts,
 
       use_stmt = vect_single_imm_use (last_stmt);
       if (!use_stmt || !is_gimple_assign (use_stmt)
-         || gimple_assign_rhs_code (use_stmt) != NOP_EXPR)
+         || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt)))
         return NULL;
 
       use_lhs = gimple_assign_lhs (use_stmt);
@@ -1429,7 +1429,7 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
               new_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt));
               /* Check if the already created pattern stmt is what we need.  */
               if (!is_gimple_assign (new_stmt)
-                  || gimple_assign_rhs_code (new_stmt) != NOP_EXPR
+                  || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (new_stmt))
                   || TREE_TYPE (gimple_assign_lhs (new_stmt)) != interm_type)
                 return false;
 
index fe67230bedf516efe1ed8bc31d3a20c6ac400b83..2264242b9ad1cdb29be5da04b431bbb1f5ee3c0a 100644 (file)
@@ -6004,7 +6004,8 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
                  gimple def_stmt = SSA_NAME_DEF_STMT (t);
 
                  while (is_gimple_assign (def_stmt)
-                        && gimple_assign_rhs_code (def_stmt)  == NOP_EXPR
+                        && CONVERT_EXPR_CODE_P
+                            (gimple_assign_rhs_code (def_stmt))
                         && TREE_CODE
                             (gimple_assign_rhs1 (def_stmt)) == SSA_NAME
                         && POINTER_TYPE_P