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]remove unnecessary sizetype dance


No that build_int_cst does caching, there's no need to prefer size_int_type.
(Especially as that'll shortly be using the same cache.)

booted & tested on i686-pc-linux-gnu, installed as obvious.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.438
diff -c -3 -p -r1.438 fold-const.c
*** fold-const.c	19 Aug 2004 10:35:54 -0000	1.438
--- fold-const.c	20 Aug 2004 10:12:27 -0000
*************** int_const_binop (enum tree_code code, tr
*** 1412,1427 ****
        abort ();
      }
  
!   /* If this is for a sizetype, can be represented as one (signed)
!      HOST_WIDE_INT word, and doesn't overflow, use size_int since it caches
!      constants.  */
!   if (is_sizetype
!       && ((hi == 0 && (HOST_WIDE_INT) low >= 0)
! 	  || (hi == -1 && (HOST_WIDE_INT) low < 0))
!       && overflow == 0 && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2))
!     return size_int_type (low, type);
!   else
!     t = build_int_cst (TREE_TYPE (arg1), low, hi);
  
    if (notrunc)
      {
--- 1412,1418 ----
        abort ();
      }
  
!   t = build_int_cst (TREE_TYPE (arg1), low, hi);
  
    if (notrunc)
      {
*************** fold_convert_const (enum tree_code code,
*** 1783,1795 ****
  	  if (TYPE_PRECISION (type) > 2 * HOST_BITS_PER_WIDE_INT)
  	    return NULL_TREE;
  
- 	  /* If we are trying to make a sizetype for a small integer, use
- 	     size_int to pick up cached types to reduce duplicate nodes.  */
- 	  if (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)
- 	      && !TREE_CONSTANT_OVERFLOW (arg1)
- 	      && compare_tree_int (arg1, 10000) < 0)
- 	    return size_int_type (TREE_INT_CST_LOW (arg1), type);
- 
  	  /* Given an integer constant, make new constant with new type,
  	     appropriately sign-extended or truncated.  */
  	  t = build_int_cst (type, TREE_INT_CST_LOW (arg1),
--- 1777,1782 ----

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