This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] (partial transition) - turn some fold_convert into build_int_cst


Hi,

in http://gcc.gnu.org/wiki/Partial_Transitions, it is said that some
'fold_convert' should be turned into 'build_int_cst'.
Here are some of them.

Bootstrapped on i686-pc-cygwin

Best regards,
Christophe Jaillet


Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c (revision 139820)
+++ gcc/omp-low.c (working copy)
@@ -2137,16 +2137,16 @@ omp_reduction_init (tree clause, tree ty
     case TRUTH_ORIF_EXPR:
     case TRUTH_XOR_EXPR:
     case NE_EXPR:
-      return fold_convert (type, integer_zero_node);
+      return build_int_cst (type, 0);

     case MULT_EXPR:
     case TRUTH_AND_EXPR:
     case TRUTH_ANDIF_EXPR:
     case EQ_EXPR:
-      return fold_convert (type, integer_one_node);
+      return build_int_cst (type, 1);

     case BIT_AND_EXPR:
-      return fold_convert (type, integer_minus_one_node);
+      return build_int_cst (type, -1);

     case MAX_EXPR:
       if (SCALAR_FLOAT_TYPE_P (type))
Index: gcc/gimple-low.c
===================================================================
--- gcc/gimple-low.c (revision 139820)
+++ gcc/gimple-low.c (working copy)
@@ -741,8 +741,8 @@ lower_builtin_setjmp (gimple_stmt_iterat
   /* Build 'DEST = 0' and insert.  */
   if (dest)
     {
-      g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest),
-         integer_zero_node));
+      g = gimple_build_assign (dest, build_int_cst (TREE_TYPE (dest),
+          0));
       gimple_set_location (g, gimple_location (stmt));
       gsi_insert_before (gsi, g, GSI_SAME_STMT);
     }
@@ -765,8 +765,8 @@ lower_builtin_setjmp (gimple_stmt_iterat
   /* Build 'DEST = 1' and insert.  */
   if (dest)
     {
-      g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest),
-         integer_one_node));
+      g = gimple_build_assign (dest, build_int_cst (TREE_TYPE (dest),
+          1));
       gimple_set_location (g, gimple_location (stmt));
       gsi_insert_before (gsi, g, GSI_SAME_STMT);
     }
Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c (revision 139820)
+++ gcc/gimplify.c (working copy)
@@ -3348,8 +3348,7 @@ gimplify_init_ctor_eval_range (tree obje
   gimplify_seq_add_stmt (pre_p, gimple_build_label (fall_thru_label));

   /* Otherwise, increment the index var...  */
-  tmp = build2 (PLUS_EXPR, var_type, var,
-  fold_convert (var_type, integer_one_node));
+  tmp = build2 (PLUS_EXPR, var_type, var, build_int_cst (var_type, 1));
   gimplify_seq_add_stmt (pre_p, gimple_build_assign (var, tmp));

   /* ...and jump back to the loop entry.  */




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]