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]

[tree-ssa] Avoid useless tree generation in tree-ssa-dom.c


The dominator optimizer can produce useless nodes when trying to optimize
conditionals using VRP.  This patch eliminates some of the useless nodes
by using int_const_binop instead of creating a new node and folding it.

This produces a very minor savings for Gerald's testcase.

Bootstrapped and regression tested i686-pc-linux-gnu.


	* tree-ssa-dom.c (extract_range_from_cond): Use int_const_binop to
	avoid creating useless tree nodes.
	
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.88
diff -c -3 -p -r1.1.2.88 tree-ssa-dom.c
*** tree-ssa-dom.c	26 Nov 2003 03:22:23 -0000	1.1.2.88
--- tree-ssa-dom.c	2 Dec 2003 22:50:32 -0000
*************** extract_range_from_cond (tree cond, tree
*** 2495,2501 ****
        break;
  
      case GT_EXPR:
!       low = fold (build (PLUS_EXPR, TREE_TYPE (op1), op1, integer_one_node));
        high = TYPE_MAX_VALUE (type);
        inverted = 0;
        break;
--- 2495,2501 ----
        break;
  
      case GT_EXPR:
!       low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1);
        high = TYPE_MAX_VALUE (type);
        inverted = 0;
        break;
*************** extract_range_from_cond (tree cond, tree
*** 2507,2513 ****
        break;
  
      case LT_EXPR:
!       high = fold (build (MINUS_EXPR, TREE_TYPE (op1), op1, 
integer_one_node));
        low = TYPE_MIN_VALUE (type);
        inverted = 0;
        break;
--- 2507,2513 ----
        break;
  
      case LT_EXPR:
!       high = int_const_binop (MINUS_EXPR, op1, integer_one_node, 1);
        low = TYPE_MIN_VALUE (type);
        inverted = 0;
        break;




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