diff mbox

[wide-int] Avoid some unnecessary wide_int temporaries

Message ID 87siv5g982.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Nov. 9, 2013, 10:28 a.m. UTC
Avoid some unnecessary "wide_int (x)"s and make more use of wi::.
(In the cp/decl.c case the wi:: avoids using HWIs rather than avoiding
a wide_int temporary.)

As far as the first hunk goes, the trunk code is:

  unsigned HOST_WIDE_INT bytes;
  ...
  if (TREE_CODE (ptr) == ADDR_EXPR)
    {
      bytes = compute_builtin_object_size (ptr, object_size_type);
      if (double_int_fits_to_tree_p (size_type_node,
				     double_int::from_uhwi (bytes)))
	return build_int_cstu (size_type_node, bytes);
    }
  else if (TREE_CODE (ptr) == SSA_NAME)
    {
      /* If object size is not known yet, delay folding until
       later.  Maybe subsequent passes will help determining
       it.  */
      bytes = compute_builtin_object_size (ptr, object_size_type);
      if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0)
          && double_int_fits_to_tree_p (size_type_node,
					double_int::from_uhwi (bytes)))
	return build_int_cstu (size_type_node, bytes);
    }

wi::fits_to_tree_p can handle both wide-int types and primitive types
so we can just pass the UHWI directly.

Tested on powerpc64-linux-gnu and by rerunning the assembly comparison.
OK to install?

Thanks,
Richard

Comments

Kenneth Zadeck Nov. 9, 2013, 3:05 p.m. UTC | #1
On 11/09/2013 05:28 AM, Richard Sandiford wrote:
> Avoid some unnecessary "wide_int (x)"s and make more use of wi::.
> (In the cp/decl.c case the wi:: avoids using HWIs rather than avoiding
> a wide_int temporary.)
>
> As far as the first hunk goes, the trunk code is:
>
>    unsigned HOST_WIDE_INT bytes;
>    ...
>    if (TREE_CODE (ptr) == ADDR_EXPR)
>      {
>        bytes = compute_builtin_object_size (ptr, object_size_type);
>        if (double_int_fits_to_tree_p (size_type_node,
> 				     double_int::from_uhwi (bytes)))
> 	return build_int_cstu (size_type_node, bytes);
>      }
>    else if (TREE_CODE (ptr) == SSA_NAME)
>      {
>        /* If object size is not known yet, delay folding until
>         later.  Maybe subsequent passes will help determining
>         it.  */
>        bytes = compute_builtin_object_size (ptr, object_size_type);
>        if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0)
>            && double_int_fits_to_tree_p (size_type_node,
> 					double_int::from_uhwi (bytes)))
> 	return build_int_cstu (size_type_node, bytes);
>      }
>
> wi::fits_to_tree_p can handle both wide-int types and primitive types
> so we can just pass the UHWI directly.
>
> Tested on powerpc64-linux-gnu and by rerunning the assembly comparison.
> OK to install?
>
> Thanks,
> Richard
>
>
> Index: gcc/builtins.c
> ===================================================================
> --- gcc/builtins.c	2013-11-09 09:46:08.763517444 +0000
> +++ gcc/builtins.c	2013-11-09 09:46:20.795598727 +0000
> @@ -12522,7 +12522,6 @@ fold_builtin_object_size (tree ptr, tree
>   {
>     unsigned HOST_WIDE_INT bytes;
>     int object_size_type;
> -  int precision = TYPE_PRECISION (TREE_TYPE (ptr));
>   
>     if (!validate_arg (ptr, POINTER_TYPE)
>         || !validate_arg (ost, INTEGER_TYPE))
> @@ -12545,11 +12544,9 @@ fold_builtin_object_size (tree ptr, tree
>   
>     if (TREE_CODE (ptr) == ADDR_EXPR)
>       {
> -      wide_int wbytes
> -	= wi::uhwi (compute_builtin_object_size (ptr, object_size_type),
> -		    precision);
> -      if (wi::fits_to_tree_p (wbytes, size_type_node))
> -	return wide_int_to_tree (size_type_node, wbytes);
> +      bytes = compute_builtin_object_size (ptr, object_size_type);
> +      if (wi::fits_to_tree_p (bytes, size_type_node))
> +	return build_int_cstu (size_type_node, bytes);
>       }
>     else if (TREE_CODE (ptr) == SSA_NAME)
>       {
> @@ -12557,10 +12554,9 @@ fold_builtin_object_size (tree ptr, tree
>          later.  Maybe subsequent passes will help determining
>          it.  */
>         bytes = compute_builtin_object_size (ptr, object_size_type);
> -      wide_int wbytes = wi::uhwi (bytes, precision);
>         if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0)
> -          && wi::fits_to_tree_p (wbytes, size_type_node))
> -	return wide_int_to_tree (size_type_node, wbytes);
> +          && wi::fits_to_tree_p (bytes, size_type_node))
> +	return build_int_cstu (size_type_node, bytes);
>       }
>   
>     return NULL_TREE;
> Index: gcc/c-family/c-common.c
> ===================================================================
> --- gcc/c-family/c-common.c	2013-11-09 09:46:18.294581832 +0000
> +++ gcc/c-family/c-common.c	2013-11-09 09:46:20.797598741 +0000
> @@ -7978,11 +7978,10 @@ handle_alloc_size_attribute (tree *node,
>     for (; args; args = TREE_CHAIN (args))
>       {
>         tree position = TREE_VALUE (args);
> -      wide_int p;
>   
>         if (TREE_CODE (position) != INTEGER_CST
> -	  || wi::ltu_p (p = wide_int (position), 1)
> -	  || wi::gtu_p (p, arg_count))
> +	  || wi::ltu_p (position, 1)
> +	  || wi::gtu_p (position, arg_count))
>   	{
>   	  warning (OPT_Wattributes,
>   	           "alloc_size parameter outside range");
> Index: gcc/cp/decl.c
> ===================================================================
> --- gcc/cp/decl.c	2013-11-09 09:46:08.763517444 +0000
> +++ gcc/cp/decl.c	2013-11-09 09:46:20.799598754 +0000
> @@ -4805,8 +4805,7 @@ check_array_designated_initializer (cons
>         if (TREE_CODE (ce->index) == INTEGER_CST)
>   	{
>   	  /* A C99 designator is OK if it matches the current index.  */
> -	  if (tree_fits_uhwi_p (ce->index)
> -	      && tree_to_uhwi (ce->index) == index)
> +	  if (wi::eq_p (ce->index, index))
>   	    return true;
>   	  else
>   	    sorry ("non-trivial designated initializers not supported");
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c	2013-11-09 09:46:19.126587453 +0000
> +++ gcc/dwarf2out.c	2013-11-09 09:46:20.802598774 +0000
> @@ -16345,7 +16345,7 @@ add_bound_info (dw_die_ref subrange_die,
>   		 || (cst_fits_uhwi_p (bound) && wi::ges_p (bound, 0)))
>   	  add_AT_unsigned (subrange_die, bound_attr, tree_to_hwi (bound));
>   	else
> -	  add_AT_wide (subrange_die, bound_attr, wide_int (bound));
> +	  add_AT_wide (subrange_die, bound_attr, bound);
>         }
>         break;
>   
> @@ -17501,7 +17501,7 @@ gen_enumeration_type_die (tree type, dw_
>   	  else
>   	    /* Enumeration constants may be wider than HOST_WIDE_INT.  Handle
>   	       that here.  */
> -	    add_AT_wide (enum_die, DW_AT_const_value, wide_int (value));
> +	    add_AT_wide (enum_die, DW_AT_const_value, value);
>   	}
>   
>         add_gnat_descriptive_type_attribute (type_die, type, context_die);
> Index: gcc/godump.c
> ===================================================================
> --- gcc/godump.c	2013-11-09 09:46:08.763517444 +0000
> +++ gcc/godump.c	2013-11-09 09:46:20.803598781 +0000
> @@ -990,7 +990,7 @@ go_output_typedef (struct godump_contain
>   		     ((unsigned HOST_WIDE_INT)
>   		      tree_to_uhwi (TREE_VALUE (element))));
>   	  else
> -	    print_hex (wide_int (element), buf);
> +	    print_hex (element, buf);
>   
>   	  mhval->value = xstrdup (buf);
>   	  *slot = mhval;
> Index: gcc/simplify-rtx.c
> ===================================================================
> --- gcc/simplify-rtx.c	2013-11-09 09:46:17.287575029 +0000
> +++ gcc/simplify-rtx.c	2013-11-09 09:46:20.804598788 +0000
> @@ -2223,7 +2223,7 @@ simplify_binary_operation_1 (enum rtx_co
>   	  else if (GET_CODE (rhs) == MULT
>   		   && CONST_INT_P (XEXP (rhs, 1)))
>   	    {
> -	      negcoeff1 = -wide_int (std::make_pair (XEXP (rhs, 1), mode));
> +	      negcoeff1 = wi::neg (std::make_pair (XEXP (rhs, 1), mode));
>   	      rhs = XEXP (rhs, 0);
>   	    }
>   	  else if (GET_CODE (rhs) == ASHIFT
> Index: gcc/tree-dump.c
> ===================================================================
> --- gcc/tree-dump.c	2013-11-09 09:46:08.763517444 +0000
> +++ gcc/tree-dump.c	2013-11-09 09:46:20.804598788 +0000
> @@ -564,7 +564,7 @@ dequeue_and_dump (dump_info_p di)
>   
>       case INTEGER_CST:
>         fprintf (di->stream, "int: ");
> -      print_decs (wide_int (t), di->stream);
> +      print_decs (t, di->stream);
>         break;
>   
>       case STRING_CST:
> Index: gcc/tree-ssa-address.c
> ===================================================================
> --- gcc/tree-ssa-address.c	2013-11-09 09:46:17.288575036 +0000
> +++ gcc/tree-ssa-address.c	2013-11-09 09:46:20.804598788 +0000
> @@ -200,7 +200,7 @@ addr_for_mem_ref (struct mem_address *ad
>     struct mem_addr_template *templ;
>   
>     if (addr->step && !integer_onep (addr->step))
> -    st = immed_wide_int_const (wide_int (addr->step), pointer_mode);
> +    st = immed_wide_int_const (addr->step, pointer_mode);
>     else
>       st = NULL_RTX;
>   
> Index: gcc/tree-ssa-ccp.c
> ===================================================================
> --- gcc/tree-ssa-ccp.c	2013-11-09 09:46:17.289575043 +0000
> +++ gcc/tree-ssa-ccp.c	2013-11-09 09:46:20.805598795 +0000
> @@ -883,8 +883,7 @@ ccp_finalize (void)
>   	}
>         else
>   	{
> -	  widest_int nonzero_bits = val->mask;
> -	  nonzero_bits = nonzero_bits | wi::to_widest (val->value);
> +	  widest_int nonzero_bits = val->mask | wi::to_widest (val->value);
>   	  nonzero_bits &= get_nonzero_bits (name);
>   	  set_nonzero_bits (name, nonzero_bits);
>   	}
> Index: gcc/tree-ssa-forwprop.c
> ===================================================================
> --- gcc/tree-ssa-forwprop.c	2013-11-09 09:46:08.763517444 +0000
> +++ gcc/tree-ssa-forwprop.c	2013-11-09 09:46:20.805598795 +0000
> @@ -2785,7 +2785,7 @@ associate_pointerplus (gimple_stmt_itera
>     if (gimple_assign_rhs1 (def_stmt) != ptr)
>       return false;
>   
> -  algn = wide_int_to_tree (TREE_TYPE (ptr), ~wide_int (algn));
> +  algn = wide_int_to_tree (TREE_TYPE (ptr), wi::bit_not (algn));
>     gimple_assign_set_rhs_with_ops (gsi, BIT_AND_EXPR, ptr, algn);
>     fold_stmt_inplace (gsi);
>     update_stmt (stmt);
> Index: gcc/tree-vrp.c
> ===================================================================
> --- gcc/tree-vrp.c	2013-11-09 09:46:17.291575056 +0000
> +++ gcc/tree-vrp.c	2013-11-09 09:46:20.807598808 +0000
> @@ -2046,16 +2046,12 @@ ranges_from_anti_range (value_range_t *a
>       {
>         vr0->type = VR_RANGE;
>         vr0->min = vrp_val_min (type);
> -      vr0->max
> -	= wide_int_to_tree (type,
> -			    wide_int (ar->min) - 1);
> +      vr0->max = wide_int_to_tree (type, wi::sub (ar->min, 1));
>       }
>     if (!vrp_val_is_max (ar->max))
>       {
>         vr1->type = VR_RANGE;
> -      vr1->min
> -	= wide_int_to_tree (type,
> -			    wide_int (ar->max) + 1);
> +      vr1->min = wide_int_to_tree (type, wi::add (ar->max, 1));
>         vr1->max = vrp_val_max (type);
>       }
>     if (vr0->type == VR_UNDEFINED)
> @@ -2429,9 +2425,9 @@ extract_range_from_binary_expr_1 (value_
>   	  if (!TYPE_OVERFLOW_WRAPS (expr_type))
>   	    {
>   	      if (vrp_val_min (expr_type))
> -		type_min = wide_int (vrp_val_min (expr_type));
> +		type_min = vrp_val_min (expr_type);
>   	      if (vrp_val_max (expr_type))
> -		type_max = wide_int (vrp_val_max (expr_type));
> +		type_max = vrp_val_max (expr_type);
>   	    }
>   
>   	  /* Check for type overflow.  */
> @@ -4996,14 +4992,14 @@ register_edge_assert_for_2 (tree name, e
>   	      wide_int minval
>   		= wi::min_value (prec, TYPE_SIGN (TREE_TYPE (val)));
>   	      new_val = val2;
> -	      if (minval == wide_int (new_val))
> +	      if (minval == new_val)
>   		new_val = NULL_TREE;
>   	    }
>   	  else
>   	    {
>   	      wide_int maxval
>   		= wi::max_value (prec, TYPE_SIGN (TREE_TYPE (val)));
> -	      mask |= wide_int (val2);
> +	      mask |= val2;
>   	      if (mask == maxval)
>   		new_val = NULL_TREE;
>   	      else
This looks all fine to me.

kenny
Mike Stump Nov. 9, 2013, 4:53 p.m. UTC | #2
On Nov 9, 2013, at 2:28 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Avoid some unnecessary "wide_int (x)"s and make more use of wi::.

> OK to install?

Nice.  Ok.
diff mbox

Patch

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	2013-11-09 09:46:08.763517444 +0000
+++ gcc/builtins.c	2013-11-09 09:46:20.795598727 +0000
@@ -12522,7 +12522,6 @@  fold_builtin_object_size (tree ptr, tree
 {
   unsigned HOST_WIDE_INT bytes;
   int object_size_type;
-  int precision = TYPE_PRECISION (TREE_TYPE (ptr));
 
   if (!validate_arg (ptr, POINTER_TYPE)
       || !validate_arg (ost, INTEGER_TYPE))
@@ -12545,11 +12544,9 @@  fold_builtin_object_size (tree ptr, tree
 
   if (TREE_CODE (ptr) == ADDR_EXPR)
     {
-      wide_int wbytes 
-	= wi::uhwi (compute_builtin_object_size (ptr, object_size_type),
-		    precision);
-      if (wi::fits_to_tree_p (wbytes, size_type_node))
-	return wide_int_to_tree (size_type_node, wbytes);
+      bytes = compute_builtin_object_size (ptr, object_size_type);
+      if (wi::fits_to_tree_p (bytes, size_type_node))
+	return build_int_cstu (size_type_node, bytes);
     }
   else if (TREE_CODE (ptr) == SSA_NAME)
     {
@@ -12557,10 +12554,9 @@  fold_builtin_object_size (tree ptr, tree
        later.  Maybe subsequent passes will help determining
        it.  */
       bytes = compute_builtin_object_size (ptr, object_size_type);
-      wide_int wbytes = wi::uhwi (bytes, precision);
       if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0)
-          && wi::fits_to_tree_p (wbytes, size_type_node))
-	return wide_int_to_tree (size_type_node, wbytes);
+          && wi::fits_to_tree_p (bytes, size_type_node))
+	return build_int_cstu (size_type_node, bytes);
     }
 
   return NULL_TREE;
Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	2013-11-09 09:46:18.294581832 +0000
+++ gcc/c-family/c-common.c	2013-11-09 09:46:20.797598741 +0000
@@ -7978,11 +7978,10 @@  handle_alloc_size_attribute (tree *node,
   for (; args; args = TREE_CHAIN (args))
     {
       tree position = TREE_VALUE (args);
-      wide_int p;
 
       if (TREE_CODE (position) != INTEGER_CST
-	  || wi::ltu_p (p = wide_int (position), 1)
-	  || wi::gtu_p (p, arg_count))
+	  || wi::ltu_p (position, 1)
+	  || wi::gtu_p (position, arg_count))
 	{
 	  warning (OPT_Wattributes,
 	           "alloc_size parameter outside range");
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	2013-11-09 09:46:08.763517444 +0000
+++ gcc/cp/decl.c	2013-11-09 09:46:20.799598754 +0000
@@ -4805,8 +4805,7 @@  check_array_designated_initializer (cons
       if (TREE_CODE (ce->index) == INTEGER_CST)
 	{
 	  /* A C99 designator is OK if it matches the current index.  */
-	  if (tree_fits_uhwi_p (ce->index) 
-	      && tree_to_uhwi (ce->index) == index)
+	  if (wi::eq_p (ce->index, index))
 	    return true;
 	  else
 	    sorry ("non-trivial designated initializers not supported");
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	2013-11-09 09:46:19.126587453 +0000
+++ gcc/dwarf2out.c	2013-11-09 09:46:20.802598774 +0000
@@ -16345,7 +16345,7 @@  add_bound_info (dw_die_ref subrange_die,
 		 || (cst_fits_uhwi_p (bound) && wi::ges_p (bound, 0)))
 	  add_AT_unsigned (subrange_die, bound_attr, tree_to_hwi (bound));
 	else
-	  add_AT_wide (subrange_die, bound_attr, wide_int (bound));
+	  add_AT_wide (subrange_die, bound_attr, bound);
       }
       break;
 
@@ -17501,7 +17501,7 @@  gen_enumeration_type_die (tree type, dw_
 	  else
 	    /* Enumeration constants may be wider than HOST_WIDE_INT.  Handle
 	       that here.  */
-	    add_AT_wide (enum_die, DW_AT_const_value, wide_int (value));
+	    add_AT_wide (enum_die, DW_AT_const_value, value);
 	}
 
       add_gnat_descriptive_type_attribute (type_die, type, context_die);
Index: gcc/godump.c
===================================================================
--- gcc/godump.c	2013-11-09 09:46:08.763517444 +0000
+++ gcc/godump.c	2013-11-09 09:46:20.803598781 +0000
@@ -990,7 +990,7 @@  go_output_typedef (struct godump_contain
 		     ((unsigned HOST_WIDE_INT)
 		      tree_to_uhwi (TREE_VALUE (element))));
 	  else
-	    print_hex (wide_int (element), buf);
+	    print_hex (element, buf);
 
 	  mhval->value = xstrdup (buf);
 	  *slot = mhval;
Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c	2013-11-09 09:46:17.287575029 +0000
+++ gcc/simplify-rtx.c	2013-11-09 09:46:20.804598788 +0000
@@ -2223,7 +2223,7 @@  simplify_binary_operation_1 (enum rtx_co
 	  else if (GET_CODE (rhs) == MULT
 		   && CONST_INT_P (XEXP (rhs, 1)))
 	    {
-	      negcoeff1 = -wide_int (std::make_pair (XEXP (rhs, 1), mode));
+	      negcoeff1 = wi::neg (std::make_pair (XEXP (rhs, 1), mode));
 	      rhs = XEXP (rhs, 0);
 	    }
 	  else if (GET_CODE (rhs) == ASHIFT
Index: gcc/tree-dump.c
===================================================================
--- gcc/tree-dump.c	2013-11-09 09:46:08.763517444 +0000
+++ gcc/tree-dump.c	2013-11-09 09:46:20.804598788 +0000
@@ -564,7 +564,7 @@  dequeue_and_dump (dump_info_p di)
 
     case INTEGER_CST:
       fprintf (di->stream, "int: ");
-      print_decs (wide_int (t), di->stream);
+      print_decs (t, di->stream);
       break;
 
     case STRING_CST:
Index: gcc/tree-ssa-address.c
===================================================================
--- gcc/tree-ssa-address.c	2013-11-09 09:46:17.288575036 +0000
+++ gcc/tree-ssa-address.c	2013-11-09 09:46:20.804598788 +0000
@@ -200,7 +200,7 @@  addr_for_mem_ref (struct mem_address *ad
   struct mem_addr_template *templ;
 
   if (addr->step && !integer_onep (addr->step))
-    st = immed_wide_int_const (wide_int (addr->step), pointer_mode);
+    st = immed_wide_int_const (addr->step, pointer_mode);
   else
     st = NULL_RTX;
 
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c	2013-11-09 09:46:17.289575043 +0000
+++ gcc/tree-ssa-ccp.c	2013-11-09 09:46:20.805598795 +0000
@@ -883,8 +883,7 @@  ccp_finalize (void)
 	}
       else
 	{
-	  widest_int nonzero_bits = val->mask;
-	  nonzero_bits = nonzero_bits | wi::to_widest (val->value);
+	  widest_int nonzero_bits = val->mask | wi::to_widest (val->value);
 	  nonzero_bits &= get_nonzero_bits (name);
 	  set_nonzero_bits (name, nonzero_bits);
 	}
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	2013-11-09 09:46:08.763517444 +0000
+++ gcc/tree-ssa-forwprop.c	2013-11-09 09:46:20.805598795 +0000
@@ -2785,7 +2785,7 @@  associate_pointerplus (gimple_stmt_itera
   if (gimple_assign_rhs1 (def_stmt) != ptr)
     return false;
 
-  algn = wide_int_to_tree (TREE_TYPE (ptr), ~wide_int (algn));
+  algn = wide_int_to_tree (TREE_TYPE (ptr), wi::bit_not (algn));
   gimple_assign_set_rhs_with_ops (gsi, BIT_AND_EXPR, ptr, algn);
   fold_stmt_inplace (gsi);
   update_stmt (stmt);
Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	2013-11-09 09:46:17.291575056 +0000
+++ gcc/tree-vrp.c	2013-11-09 09:46:20.807598808 +0000
@@ -2046,16 +2046,12 @@  ranges_from_anti_range (value_range_t *a
     {
       vr0->type = VR_RANGE;
       vr0->min = vrp_val_min (type);
-      vr0->max
-	= wide_int_to_tree (type,
-			    wide_int (ar->min) - 1);
+      vr0->max = wide_int_to_tree (type, wi::sub (ar->min, 1));
     }
   if (!vrp_val_is_max (ar->max))
     {
       vr1->type = VR_RANGE;
-      vr1->min
-	= wide_int_to_tree (type,
-			    wide_int (ar->max) + 1);
+      vr1->min = wide_int_to_tree (type, wi::add (ar->max, 1));
       vr1->max = vrp_val_max (type);
     }
   if (vr0->type == VR_UNDEFINED)
@@ -2429,9 +2425,9 @@  extract_range_from_binary_expr_1 (value_
 	  if (!TYPE_OVERFLOW_WRAPS (expr_type))
 	    {
 	      if (vrp_val_min (expr_type))
-		type_min = wide_int (vrp_val_min (expr_type));
+		type_min = vrp_val_min (expr_type);
 	      if (vrp_val_max (expr_type))
-		type_max = wide_int (vrp_val_max (expr_type));
+		type_max = vrp_val_max (expr_type);
 	    }
 
 	  /* Check for type overflow.  */
@@ -4996,14 +4992,14 @@  register_edge_assert_for_2 (tree name, e
 	      wide_int minval
 		= wi::min_value (prec, TYPE_SIGN (TREE_TYPE (val)));
 	      new_val = val2;
-	      if (minval == wide_int (new_val))
+	      if (minval == new_val)
 		new_val = NULL_TREE;
 	    }
 	  else
 	    {
 	      wide_int maxval
 		= wi::max_value (prec, TYPE_SIGN (TREE_TYPE (val)));
-	      mask |= wide_int (val2);
+	      mask |= val2;
 	      if (mask == maxval)
 		new_val = NULL_TREE;
 	      else