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]

Minor cleanup in fold


This improves the ordering of tests in the early part of fold.

Tested on i686-pc-linux-gnu.

2002-07-19  Olivier Hainque <hainque at act-europe dot fr>

        * fold-const.c (fold): Reorder tests for conditional expressions.

*** gcc/fold-const.c	8 Apr 2003 23:28:28 -0000	1.244
--- gcc/fold-const.c	11 Apr 2003 20:09:19 -0000
*************** fold (expr)
*** 5064,5067 ****
--- 5064,5075 ----
  			    fold (build1 (code, type, integer_zero_node))));
     }
+   else if (TREE_CODE_CLASS (code) == '<'
+ 	   && TREE_CODE (arg0) == COMPOUND_EXPR)
+     return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
+ 		  fold (build (code, type, TREE_OPERAND (arg0, 1), arg1)));
+   else if (TREE_CODE_CLASS (code) == '<'
+ 	   && TREE_CODE (arg1) == COMPOUND_EXPR)
+     return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
+ 		  fold (build (code, type, arg0, TREE_OPERAND (arg1, 1))));
    else if (TREE_CODE_CLASS (code) == '2'
  	   || TREE_CODE_CLASS (code) == '<')
*************** fold (expr)
*** 5099,5110 ****
  					       /*cond_first_p=*/1);
      }
-   else if (TREE_CODE_CLASS (code) == '<'
- 	   && TREE_CODE (arg0) == COMPOUND_EXPR)
-     return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
- 		  fold (build (code, type, TREE_OPERAND (arg0, 1), arg1)));
-   else if (TREE_CODE_CLASS (code) == '<'
- 	   && TREE_CODE (arg1) == COMPOUND_EXPR)
-     return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
- 		  fold (build (code, type, arg0, TREE_OPERAND (arg1, 1))));
  
    switch (code)
--- 5107,5110 ----


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