]> gcc.gnu.org Git - gcc.git/commitdiff
builtins.c (fold_builtin_signbit): Use build_zero_cst instead of fold_convert.
authorNathan Froyd <froydnj@codesourcery.com>
Wed, 3 Nov 2010 00:49:00 +0000 (00:49 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Wed, 3 Nov 2010 00:49:00 +0000 (00:49 +0000)
gcc/
* builtins.c (fold_builtin_signbit): Use build_zero_cst instead of
fold_convert.
* c-typeck.c (build_function_call_vec): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* cgraphunit.c (assemble_thunk): Likewise.
* config/sparc/sparc.c (sparc_fold_builtin): Likewise.
* fold-const.c (fold_unary_loc, fold_mult_zconjz): Likewise.
(fold_binary_loc, fold_ternary_loc): Likewise.
* gimple-fold.c (get_symbol_constant_value): Likewise.
* gimple-low.c (lower_builtin_setjmp): Likewise.
* gimple.c (gimple_cond_get_ops_from_tree): Likewise.
* gimplify.c (gimplify_init_constructor): Likewise.
* lambda.h (build_linear_expr): Likewise.
* omp-low.c (omp_reduction_init): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
* tree-object-size.c (compute_object_sizes): Likewise.
* tree-sra.c (init_subtree_with_zero): Likewise.
(sra_ipa_modify_assign): Likewise.
* tree-ssa-copy.c (propagate_tree_value_into_stmt): Likewise.
* tree-ssa-reassoc.c (eliminate_duplicate_pair): Likewise.
(eliminate_plus_minus_pair, eliminate_not_pairs): Likewise.
(undistribute_ops_list): Likewise.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
* tree-vect-stmts.c (vectorizable_call): Likewise.
* tree.c (build_vector_from_ctor, build_one_cst): Likewise.
(build_zero_cst): Handle more cases directly.  Update comment.

gcc/cp/
* class.c (build_base_path, add_vcall_offset): Use build_zero_cst
instead of fold_convert.
* init.c (build_zero_init): Likewise.
* typeck.c (cp_build_binary_op): Likewise.

gcc/fortran/
* trans-decl.c (add_argument_checking): Use build_zero_cst instead of
fold_convert.
* trans-expr.c (gfc_conv_missing_dummy, fill_with_spaces): Likewise.
* trans-stmt.c (gfc_trans_do): Likewise.

From-SVN: r166227

29 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/c-typeck.c
gcc/cfgexpand.c
gcc/cgraphunit.c
gcc/config/sparc/sparc.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/init.c
gcc/cp/typeck.c
gcc/fold-const.c
gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-stmt.c
gcc/gimple-fold.c
gcc/gimple-low.c
gcc/gimple.c
gcc/gimplify.c
gcc/lambda.h
gcc/omp-low.c
gcc/tree-inline.c
gcc/tree-object-size.c
gcc/tree-sra.c
gcc/tree-ssa-copy.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-sccvn.c
gcc/tree-vect-stmts.c
gcc/tree.c

index 61f8fded4aef6fc332064fead02651f48a7628f0..bebc9823c23589205f28a399a5e43d1cfcb54e33 100644 (file)
@@ -1,3 +1,32 @@
+2010-11-02  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * builtins.c (fold_builtin_signbit): Use build_zero_cst instead of
+       fold_convert.
+       * c-typeck.c (build_function_call_vec): Likewise.
+       * cfgexpand.c (expand_debug_expr): Likewise.
+       * cgraphunit.c (assemble_thunk): Likewise.
+       * config/sparc/sparc.c (sparc_fold_builtin): Likewise.
+       * fold-const.c (fold_unary_loc, fold_mult_zconjz): Likewise.
+       (fold_binary_loc, fold_ternary_loc): Likewise.
+       * gimple-fold.c (get_symbol_constant_value): Likewise.
+       * gimple-low.c (lower_builtin_setjmp): Likewise.
+       * gimple.c (gimple_cond_get_ops_from_tree): Likewise.
+       * gimplify.c (gimplify_init_constructor): Likewise.
+       * lambda.h (build_linear_expr): Likewise.
+       * omp-low.c (omp_reduction_init): Likewise.
+       * tree-inline.c (remap_ssa_name): Likewise.
+       * tree-object-size.c (compute_object_sizes): Likewise.
+       * tree-sra.c (init_subtree_with_zero): Likewise.
+       (sra_ipa_modify_assign): Likewise.
+       * tree-ssa-copy.c (propagate_tree_value_into_stmt): Likewise.
+       * tree-ssa-reassoc.c (eliminate_duplicate_pair): Likewise.
+       (eliminate_plus_minus_pair, eliminate_not_pairs): Likewise.
+       (undistribute_ops_list): Likewise.
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
+       * tree-vect-stmts.c (vectorizable_call): Likewise.
+       * tree.c (build_vector_from_ctor, build_one_cst): Likewise.
+       (build_zero_cst): Handle more cases directly.  Update comment.
+
 2010-11-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/i386-protos.h (ix86_split_call_pop_vzeroupper):
index ced2fa7bd6b94d946249952520134c430eadcbf2..4ff0546c6d4613801899dd4c9f446e7c28b12be3 100644 (file)
@@ -9101,8 +9101,6 @@ fold_builtin_strncmp (location_t loc, tree arg1, tree arg2, tree len)
 static tree
 fold_builtin_signbit (location_t loc, tree arg, tree type)
 {
-  tree temp;
-
   if (!validate_arg (arg, REAL_TYPE))
     return NULL_TREE;
 
@@ -9113,8 +9111,9 @@ fold_builtin_signbit (location_t loc, tree arg, tree type)
       REAL_VALUE_TYPE c;
 
       c = TREE_REAL_CST (arg);
-      temp = REAL_VALUE_NEGATIVE (c) ? integer_one_node : integer_zero_node;
-      return fold_convert_loc (loc, type, temp);
+      return (REAL_VALUE_NEGATIVE (c)
+             ? build_one_cst (type)
+             : build_zero_cst (type));
     }
 
   /* If ARG is non-negative, the result is always zero.  */
index 4c53ef06d60fa0767267066d88c263ac3657b06a..7f448ddf2ba8f9fffa709356a17ee5415d8ad346 100644 (file)
@@ -2821,7 +2821,7 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
                                          build_constructor (return_type, 0),
                                          false);
          else
-           rhs = fold_convert_loc (loc, return_type, integer_zero_node);
+           rhs = build_zero_cst (return_type);
 
          return require_complete_type (build2 (COMPOUND_EXPR, return_type,
                                                trap, rhs));
index 1ef1fa0d8f283619e4a4dbb1cddf95312633c875..f02a8cd2ba042a1ede8bc7912e6522144c6ede5c 100644 (file)
@@ -3073,7 +3073,7 @@ expand_debug_expr (tree exp)
          if (i < TYPE_VECTOR_SUBPARTS (TREE_TYPE (exp)))
            {
              op1 = expand_debug_expr
-               (fold_convert (TREE_TYPE (TREE_TYPE (exp)), integer_zero_node));
+               (build_zero_cst (TREE_TYPE (TREE_TYPE (exp))));
 
              if (!op1)
                return NULL;
index 2abcb67e66a7e35eddf967de47da66432612db46..ed86a029690e3416da30c84bb7f1215d76c34025 100644 (file)
@@ -1411,8 +1411,7 @@ assemble_thunk (struct cgraph_node *node)
              remove_edge (single_succ_edge (bb));
              true_label = gimple_block_label (then_bb);
              stmt = gimple_build_cond (NE_EXPR, restmp,
-                                       fold_convert (TREE_TYPE (restmp),
-                                                     integer_zero_node),
+                                       build_zero_cst (TREE_TYPE (restmp)),
                                        NULL_TREE, NULL_TREE);
              gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
              make_edge (bb, then_bb, EDGE_TRUE_VALUE);
@@ -1429,8 +1428,8 @@ assemble_thunk (struct cgraph_node *node)
            {
              gimple stmt;
              bsi = gsi_last_bb (else_bb);
-             stmt = gimple_build_assign (restmp, fold_convert (TREE_TYPE (restmp),
-                                                               integer_zero_node));
+             stmt = gimple_build_assign (restmp,
+                                         build_zero_cst (TREE_TYPE (restmp)));
              gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
              bsi = gsi_last_bb (return_bb);
            }
index e23ede053a000c43f65f7302ed8a11814b2f4893..4793e772bdaabd787690e7be65237e273d6746a7 100644 (file)
@@ -8748,7 +8748,7 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
   if (ignore
       && icode != CODE_FOR_alignaddrsi_vis
       && icode != CODE_FOR_alignaddrdi_vis)
-    return fold_convert (rtype, integer_zero_node);
+    return build_zero_cst (rtype);
 
   switch (icode)
     {
index 0bfb03bf0b6b47b1b1063f983fe18f23880c96a9..24783f5c4358bc9f6e1ec12a56faa845416f201a 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-02  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * class.c (build_base_path, add_vcall_offset): Use build_zero_cst
+       instead of fold_convert.
+       * init.c (build_zero_init): Likewise.
+       * typeck.c (cp_build_binary_op): Likewise.
+
 2010-11-02  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/46170
index 7aa697450d1e3fbbd3940cf4b1f1ae2dfbba5724..ded0a0399726fc85365235625acca2ef19ae8145 100644 (file)
@@ -431,8 +431,7 @@ build_base_path (enum tree_code code,
  out:
   if (null_test)
     expr = fold_build3_loc (input_location, COND_EXPR, target_type, null_test, expr,
-                       fold_build1_loc (input_location, NOP_EXPR, target_type,
-                                    integer_zero_node));
+                           build_zero_cst (target_type));
 
   return expr;
 }
@@ -8267,8 +8266,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
       /* Find the overriding function.  */
       fn = find_final_overrider (vid->rtti_binfo, binfo, orig_fn);
       if (fn == error_mark_node)
-       vcall_offset = build1 (NOP_EXPR, vtable_entry_type,
-                              integer_zero_node);
+       vcall_offset = build_zero_cst (vtable_entry_type);
       else
        {
          base = TREE_VALUE (fn);
index d632816c654c1a54b1dff36b987b3c9096f99216..1f73d148ac1e5fa866b31c7841599a5e4e9808c9 100644 (file)
@@ -254,7 +254,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
       init = build_constructor (type, v);
     }
   else if (TREE_CODE (type) == VECTOR_TYPE)
-    init = fold_convert (type, integer_zero_node);
+    init = build_zero_cst (type);
   else
     gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
 
index 5f8d32162f04b979345444fb8ab46ab5b0d79970..6a52fc47645d5f36eca4a84e79015193672802ae 100644 (file)
@@ -4047,8 +4047,7 @@ cp_build_binary_op (location_t location,
              tree e1 = cp_build_binary_op (location,
                                            EQ_EXPR,
                                            pfn0,       
-                                           fold_convert (TREE_TYPE (pfn0),
-                                                         integer_zero_node),
+                                           build_zero_cst (TREE_TYPE (pfn0)),
                                            complain);
              tree e2 = cp_build_binary_op (location,
                                            BIT_AND_EXPR, 
@@ -4138,8 +4137,7 @@ cp_build_binary_op (location_t location,
                                       complain);
              e2 = cp_build_binary_op (location, EQ_EXPR,
                                       pfn0,
-                                      fold_convert (TREE_TYPE (pfn0),
-                                                    integer_zero_node),
+                                      build_zero_cst (TREE_TYPE (pfn0)),
                                       complain);
              e2 = cp_build_binary_op (location,
                                       TRUTH_ANDIF_EXPR, e2, e1, complain);
@@ -4164,8 +4162,7 @@ cp_build_binary_op (location_t location,
              e2 = cp_build_binary_op (location,
                                       EQ_EXPR,
                                       pfn0,
-                                      fold_convert (TREE_TYPE (pfn0),
-                                                    integer_zero_node),
+                                      build_zero_cst (TREE_TYPE (pfn0)),
                                       complain);
              e1 = cp_build_binary_op (location,
                                       TRUTH_ORIF_EXPR, e1, e2, complain);
index 67268ade5ccca5f04e28ac23cc41706477d12c54..da890f14c3db998d3da541a4d3a93007567f5cf5 100644 (file)
@@ -8228,7 +8228,7 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
 
     case IMAGPART_EXPR:
       if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
-       return fold_convert_loc (loc, type, integer_zero_node);
+       return build_zero_cst (type);
       if (TREE_CODE (arg0) == COMPLEX_EXPR)
        return omit_one_operand_loc (loc, type, TREE_OPERAND (arg0, 1),
                                 TREE_OPERAND (arg0, 0));
@@ -9283,7 +9283,7 @@ fold_mult_zconjz (location_t loc, tree type, tree expr)
                     fold_build2_loc (loc, MULT_EXPR, itype, rpart, rpart),
                     fold_build2_loc (loc, MULT_EXPR, itype, ipart, ipart));
   return fold_build2_loc (loc, COMPLEX_EXPR, type, tem,
-                     fold_convert_loc (loc, itype, integer_zero_node));
+                         build_zero_cst (itype));
 }
 
 
@@ -10275,7 +10275,7 @@ fold_binary_loc (location_t loc,
 
       if ((!FLOAT_TYPE_P (type) || !HONOR_NANS (TYPE_MODE (type)))
          && operand_equal_p (arg0, arg1, 0))
-       return fold_convert_loc (loc, type, integer_zero_node);
+       return build_zero_cst (type);
 
       /* A - B -> A + (-B) if B is easily negatable.  */
       if (negate_expr_p (arg1)
@@ -10662,7 +10662,7 @@ fold_binary_loc (location_t loc,
       if (TREE_CODE (arg0) == BIT_NOT_EXPR
          && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
        {
-         t1 = fold_convert_loc (loc, type, integer_zero_node);
+         t1 = build_zero_cst (type);
          t1 = fold_unary_loc (loc, BIT_NOT_EXPR, type, t1);
          return omit_one_operand_loc (loc, type, t1, arg1);
        }
@@ -10671,7 +10671,7 @@ fold_binary_loc (location_t loc,
       if (TREE_CODE (arg1) == BIT_NOT_EXPR
          && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
        {
-         t1 = fold_convert_loc (loc, type, integer_zero_node);
+         t1 = build_zero_cst (type);
          t1 = fold_unary_loc (loc, BIT_NOT_EXPR, type, t1);
          return omit_one_operand_loc (loc, type, t1, arg0);
        }
@@ -10801,7 +10801,7 @@ fold_binary_loc (location_t loc,
       if (TREE_CODE (arg0) == BIT_NOT_EXPR
          && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
        {
-         t1 = fold_convert_loc (loc, type, integer_zero_node);
+         t1 = build_zero_cst (type);
          t1 = fold_unary_loc (loc, BIT_NOT_EXPR, type, t1);
          return omit_one_operand_loc (loc, type, t1, arg1);
        }
@@ -10810,7 +10810,7 @@ fold_binary_loc (location_t loc,
       if (TREE_CODE (arg1) == BIT_NOT_EXPR
          && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
        {
-         t1 = fold_convert_loc (loc, type, integer_zero_node);
+         t1 = build_zero_cst (type);
          t1 = fold_unary_loc (loc, BIT_NOT_EXPR, type, t1);
          return omit_one_operand_loc (loc, type, t1, arg0);
        }
@@ -13598,7 +13598,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
              if (elements)
                return TREE_VALUE (elements);
              else
-               return fold_convert_loc (loc, type, integer_zero_node);
+               return build_zero_cst (type);
            }
        }
 
index 05cab00e362a5163f2cc6b29b7caa00ddbd064db..86e8d168df913f61d2ac87f3f82268d395e61d98 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-02  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * trans-decl.c (add_argument_checking): Use build_zero_cst instead of
+       fold_convert.
+       * trans-expr.c (gfc_conv_missing_dummy, fill_with_spaces): Likewise.
+       * trans-stmt.c (gfc_trans_do): Likewise.
+
 2010-11-02  Steven G. Kargl  < kargl@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>
 
index 4b668c8782c7db5004670c41a112e4072ed257b0..8e5c294b99f61b34d574c78b676fc9aa8cc558e6 100644 (file)
@@ -4216,8 +4216,7 @@ add_argument_checking (stmtblock_t *block, gfc_symbol *sym)
            not_0length = fold_build2_loc (input_location, NE_EXPR,
                                           boolean_type_node,
                                           cl->passed_length,
-                                          fold_convert (gfc_charlen_type_node,
-                                                        integer_zero_node));
+                                          build_zero_cst (gfc_charlen_type_node));
            /* The symbol needs to be referenced for gfc_get_symbol_decl.  */
            fsym->attr.referenced = 1;
            not_absent = gfc_conv_expr_present (fsym);
index c1588f8c74956072eff5dad6b7998309148c0a08..8da6cf0ef1331fa09951d7c43fa2f15b56460424 100644 (file)
@@ -187,7 +187,7 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
     {
       tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (se->expr),
                        present, se->expr,
-                       fold_convert (TREE_TYPE (se->expr), integer_zero_node));
+                       build_zero_cst (TREE_TYPE (se->expr)));
       tmp = gfc_evaluate_now (tmp, &se->pre);
       se->expr = tmp;
     }
@@ -3634,7 +3634,7 @@ fill_with_spaces (tree start, tree type, tree size)
 
   /* Exit condition.  */
   cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node, i,
-                         fold_convert (sizetype, integer_zero_node));
+                         build_zero_cst (sizetype));
   tmp = build1_v (GOTO_EXPR, exit_label);
   tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond, tmp,
                         build_empty_stmt (input_location));
index da790d8c49e57d1289ab86672fc21982cf54dae3..f065adbe0817bb7ae4c1f5eeafc1fdbbec225424 100644 (file)
@@ -1126,7 +1126,7 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
   if (gfc_option.rtcheck & GFC_RTCHECK_DO)
     {
       tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, step,
-                            fold_convert (type, integer_zero_node));
+                            build_zero_cst (type));
       gfc_trans_runtime_check (true, false, tmp, &block, &code->loc,
                               "DO step value is zero");
     }
@@ -1138,7 +1138,7 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
     return gfc_trans_simple_do (code, &block, dovar, from, to, step, exit_cond);
 
   pos_step = fold_build2_loc (loc, GT_EXPR, boolean_type_node, step,
-                             fold_convert (type, integer_zero_node));
+                             build_zero_cst (type));
 
   if (TREE_CODE (type) == INTEGER_TYPE)
     utype = unsigned_type_for (type);
index f77b63085bd015b0e97cc5387b2ae6d88ad35e03..e561a63fdb8fea63d325c30cebb12944e485e181 100644 (file)
@@ -159,7 +159,7 @@ get_symbol_constant_value (tree sym)
       if (!val
           && (INTEGRAL_TYPE_P (TREE_TYPE (sym))
               || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym))))
-       return fold_convert (TREE_TYPE (sym), integer_zero_node);
+       return build_zero_cst (TREE_TYPE (sym));
     }
 
   return NULL_TREE;
index 1f7ae2ffdac23c9347651f02377098c60daaaaf3..dcbb560cab199f5334f3313b9b40128b648b58e8 100644 (file)
@@ -844,8 +844,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
   /* Build 'DEST = 0' and insert.  */
   if (dest)
     {
-      g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
-                                                      integer_zero_node));
+      g = gimple_build_assign (dest, build_zero_cst (TREE_TYPE (dest)));
       gimple_set_location (g, loc);
       gimple_set_block (g, gimple_block (stmt));
       gsi_insert_before (gsi, g, GSI_SAME_STMT);
index dea0b8355d2c9623e36e2eed2070399824cb428e..1bb241a62b3488d2e35ceca3af7c2ad596139a7d 100644 (file)
@@ -449,7 +449,6 @@ void
 gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
                                tree *lhs_p, tree *rhs_p)
 {
-  location_t loc = EXPR_LOCATION (cond);
   gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
              || TREE_CODE (cond) == TRUTH_NOT_EXPR
              || is_gimple_min_invariant (cond)
@@ -462,14 +461,14 @@ gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
     {
       *code_p = EQ_EXPR;
       gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
-      *rhs_p = fold_convert_loc (loc, TREE_TYPE (*lhs_p), integer_zero_node);
+      *rhs_p = build_zero_cst (TREE_TYPE (*lhs_p));
     }
   /* Canonicalize conditionals of the form 'if (VAL)'  */
   else if (TREE_CODE_CLASS (*code_p) != tcc_comparison)
     {
       *code_p = NE_EXPR;
       gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
-      *rhs_p = fold_convert_loc (loc, TREE_TYPE (*lhs_p), integer_zero_node);
+      *rhs_p = build_zero_cst (TREE_TYPE (*lhs_p));
     }
 }
 
index 885f01328751824870b85b1f522ffa37d579bc74..94a6689c61f9c235db5dc15459e07eb8df4876ea 100644 (file)
@@ -3885,7 +3885,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
        i = VEC_index (constructor_elt, elts, 1)->value;
        if (r == NULL || i == NULL)
          {
-           tree zero = fold_convert (TREE_TYPE (type), integer_zero_node);
+           tree zero = build_zero_cst (TREE_TYPE (type));
            if (r == NULL)
              r = zero;
            if (i == NULL)
index 8ef11b9dc6caca4f22a798ed98021e2ec4110761..d54ed277a7e56d2e4991e2cb56ef2ed9b931270a 100644 (file)
@@ -486,7 +486,7 @@ build_linear_expr (tree type, lambda_vector coefs, VEC (tree, heap) *ivs)
 {
   unsigned i;
   tree iv;
-  tree expr = fold_convert (type, integer_zero_node);
+  tree expr = build_zero_cst (type);
 
   for (i = 0; VEC_iterate (tree, ivs, i, iv); i++)
     {
index 3fe94c94999b39c51634c0070a887c132276f3c9..54c243c025c1f144a3660605cf59a92129e21ce9 100644 (file)
@@ -2167,7 +2167,7 @@ omp_reduction_init (tree clause, tree type)
     case TRUTH_ORIF_EXPR:
     case TRUTH_XOR_EXPR:
     case NE_EXPR:
-      return fold_convert_loc (loc, type, integer_zero_node);
+      return build_zero_cst (type);
 
     case MULT_EXPR:
     case TRUTH_AND_EXPR:
index 133d916b9c66e2bfcb4962fea0c3ef526452dd25..cf8a68e9f93c8cfd810e33bbf42e25942a8ff57f 100644 (file)
@@ -242,10 +242,9 @@ remap_ssa_name (tree name, copy_body_data *id)
            {
              gimple_stmt_iterator gsi = gsi_last_bb (id->entry_bb);
              gimple init_stmt;
+             tree zero = build_zero_cst (TREE_TYPE (new_tree));
 
-             init_stmt = gimple_build_assign (new_tree,
-                                              fold_convert (TREE_TYPE (new_tree),
-                                                           integer_zero_node));
+             init_stmt = gimple_build_assign (new_tree, zero);
              gsi_insert_after (&gsi, init_stmt, GSI_NEW_STMT);
              SSA_NAME_IS_DEFAULT_DEF (new_tree) = 0;
            }
index 2e8ba2699a060c595ec8d4ebd6a15427b22a8d5d..092348b28b4ebb7e2b296701062ed27543435947 100644 (file)
@@ -1231,8 +1231,7 @@ compute_object_sizes (void)
                        result = fold_convert (size_type_node,
                                               integer_minus_one_node);
                      else if (object_size_type < 4)
-                       result = fold_convert (size_type_node,
-                                              integer_zero_node);
+                       result = build_zero_cst (size_type_node);
                    }
                }
 
index 3328261b9e47c583674a40e89ddcba12c54c0b54..4f0d2e527d3451d3e2da01bfe54b396ebb17f64f 100644 (file)
@@ -2324,8 +2324,7 @@ init_subtree_with_zero (struct access *access, gimple_stmt_iterator *gsi,
       gimple stmt;
 
       stmt = gimple_build_assign (get_access_replacement (access),
-                                 fold_convert (access->type,
-                                               integer_zero_node));
+                                 build_zero_cst (access->type));
       if (insert_after)
        gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
       else
@@ -4098,7 +4097,7 @@ sra_ipa_modify_assign (gimple *stmt_ptr, gimple_stmt_iterator *gsi,
            {
              /* V_C_Es of constructors can cause trouble (PR 42714).  */
              if (is_gimple_reg_type (TREE_TYPE (*lhs_p)))
-               *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node);
+               *rhs_p = build_zero_cst (TREE_TYPE (*lhs_p));
              else
                *rhs_p = build_constructor (TREE_TYPE (*lhs_p), 0);
            }
index a92b63be5f95b65ec94a1398026c5f3bd0964744..68370336a76ce117e4014cac02d632800e93289f 100644 (file)
@@ -246,7 +246,7 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
   else if (gimple_code (stmt) == GIMPLE_COND)
     {
       tree lhs = NULL_TREE;
-      tree rhs = fold_convert (TREE_TYPE (val), integer_zero_node);
+      tree rhs = build_zero_cst (TREE_TYPE (val));
       propagate_tree_value (&lhs, val);
       gimple_cond_set_code (stmt, NE_EXPR);
       gimple_cond_set_lhs (stmt, lhs);
index b4cadfedae5b0628dbaa320fe41e2dd907154601..790635cf05bcb0ba1edc688b6ae296c546e30943 100644 (file)
@@ -467,8 +467,7 @@ eliminate_duplicate_pair (enum tree_code opcode,
            {
              VEC_free (operand_entry_t, heap, *ops);
              *ops = NULL;
-             add_to_ops_vec (ops, fold_convert (TREE_TYPE (last->op),
-                                                integer_zero_node));
+             add_to_ops_vec (ops, build_zero_cst (TREE_TYPE (last->op)));
              *all_done = true;
            }
          else
@@ -535,8 +534,7 @@ eliminate_plus_minus_pair (enum tree_code opcode,
            }
 
          VEC_ordered_remove (operand_entry_t, *ops, i);
-         add_to_ops_vec (ops, fold_convert(TREE_TYPE (oe->op),
-                                           integer_zero_node));
+         add_to_ops_vec (ops, build_zero_cst (TREE_TYPE (oe->op)));
          VEC_ordered_remove (operand_entry_t, *ops, currindex);
          reassociate_stats.ops_eliminated ++;
 
@@ -623,7 +621,7 @@ eliminate_not_pairs (enum tree_code opcode,
            }
 
          if (opcode == BIT_AND_EXPR)
-           oe->op = fold_convert (TREE_TYPE (oe->op), integer_zero_node);
+           oe->op = build_zero_cst (TREE_TYPE (oe->op));
          else if (opcode == BIT_IOR_EXPR)
            oe->op = build_low_bits_mask (TREE_TYPE (oe->op),
                                          TYPE_PRECISION (TREE_TYPE (oe->op)));
@@ -1177,7 +1175,7 @@ undistribute_ops_list (enum tree_code opcode,
                }
              zero_one_operation (&oe2->op, c->oecode, c->op);
              sum = build_and_add_sum (tmpvar, oe1->op, oe2->op, opcode);
-             oe2->op = fold_convert (TREE_TYPE (oe2->op), integer_zero_node);
+             oe2->op = build_zero_cst (TREE_TYPE (oe2->op));
              oe2->rank = 0;
              oe1->op = gimple_get_lhs (sum);
            }
index 557c393037ad6f54522eb4099a161d1d6b34c2b4..02613aabda190af315d28ce2f33bfec002652a24 100644 (file)
@@ -1338,7 +1338,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
          && offset2 <= offset
          && offset2 + size2 >= offset + maxsize)
        {
-         tree val = fold_convert (vr->type, integer_zero_node);
+         tree val = build_zero_cst (vr->type);
          unsigned int value_id = get_or_alloc_constant_value_id (val);
          return vn_reference_insert_pieces (vuse, vr->set, vr->type,
                                             VEC_copy (vn_reference_op_s,
@@ -1361,7 +1361,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
          && offset2 <= offset
          && offset2 + size2 >= offset + maxsize)
        {
-         tree val = fold_convert (vr->type, integer_zero_node);
+         tree val = build_zero_cst (vr->type);
          unsigned int value_id = get_or_alloc_constant_value_id (val);
          return vn_reference_insert_pieces (vuse, vr->set, vr->type,
                                             VEC_copy (vn_reference_op_s,
index 183bb111a304912cfcb17e7cc7c5128b315f924f..4961ccbccc7802b42f979d70677cbd4c14e63fb1 100644 (file)
@@ -1580,7 +1580,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt)
 
   type = TREE_TYPE (scalar_dest);
   new_stmt = gimple_build_assign (gimple_call_lhs (stmt),
-                                 fold_convert (type, integer_zero_node));
+                                 build_zero_cst (type));
   set_vinfo_for_stmt (new_stmt, stmt_info);
   set_vinfo_for_stmt (stmt, NULL);
   STMT_VINFO_STMT (stmt_info) = new_stmt;
index 1cc99f07c67a697fcecc3008cf19e1d5d403a3fd..4a27fd28206517a6b588c33f134160bacf3648f3 100644 (file)
@@ -1362,7 +1362,7 @@ build_vector_from_ctor (tree type, VEC(constructor_elt,gc) *v)
     list = tree_cons (NULL_TREE, value, list);
   for (; idx < TYPE_VECTOR_SUBPARTS (type); ++idx)
     list = tree_cons (NULL_TREE,
-                     fold_convert (TREE_TYPE (type), integer_zero_node), list);
+                     build_zero_cst (TREE_TYPE (type)), list);
   return build_vector (type, nreverse (list));
 }
 
@@ -1599,22 +1599,52 @@ build_one_cst (tree type)
     case COMPLEX_TYPE:
       return build_complex (type,
                            build_one_cst (TREE_TYPE (type)),
-                           fold_convert (TREE_TYPE (type), integer_zero_node));
+                           build_zero_cst (TREE_TYPE (type)));
 
     default:
       gcc_unreachable ();
     }
 }
 
-/* Build 0 constant of type TYPE.  This is used by constructor folding and thus
-   the constant should correspond zero in memory representation.  */
+/* Build 0 constant of type TYPE.  This is used by constructor folding
+   and thus the constant should be represented in memory by
+   zero(es).  */
 
 tree
 build_zero_cst (tree type)
 {
-  if (!AGGREGATE_TYPE_P (type))
-    return fold_convert (type, integer_zero_node);
-  return build_constructor (type, NULL);
+  switch (TREE_CODE (type))
+    {
+    case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
+    case POINTER_TYPE: case REFERENCE_TYPE:
+    case OFFSET_TYPE:
+      return build_int_cst (type, 0);
+
+    case REAL_TYPE:
+      return build_real (type, dconst0);
+
+    case FIXED_POINT_TYPE:
+      return build_fixed (type, FCONST0 (TYPE_MODE (type)));
+
+    case VECTOR_TYPE:
+      {
+       tree scalar = build_zero_cst (TREE_TYPE (type));
+
+       return build_vector_from_val (type, scalar);
+      }
+
+    case COMPLEX_TYPE:
+      {
+       tree zero = build_zero_cst (TREE_TYPE (type));
+
+       return build_complex (type, zero, zero);
+      }
+
+    default:
+      if (!AGGREGATE_TYPE_P (type))
+       return fold_convert (type, integer_zero_node);
+      return build_constructor (type, NULL);
+    }
 }
 
 
This page took 0.256852 seconds and 5 git commands to generate.