Adjust STRIP_USELESS_TYPE_CONVERSION

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sat Jul 3 13:47:00 GMT 2004


It should reallty strip useless VIEW_CONVERT_EXPRs too and if it also does
NON_LVALUE_EXPR, we remove two sets of strips.

Tested on x86_64-linux-gnu.

2004-07-03  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
	
	* tree-ssa.c (tree_ssa_useless_type_conversion): Also look at
	VIEW_CONVERT_EXPR and NON_LVALUE_EXPR.
	* tree-ssa-ccp.c (fold_stmt): Call just STRIP_USELESS_TYPE_CONVERSION.
	* tree-ssa-dom.c (local_fold): Likewise.

*** tree-ssa-ccp.c	29 Jun 2004 06:59:34 -0000	2.14
--- tree-ssa-ccp.c	2 Jul 2004 18:47:50 -0000
*************** fold_stmt (tree *stmt_p)
*** 2087,2091 ****
       may have been added by fold, and "useless" type conversions that might
       now be apparent due to propagation.  */
-   STRIP_MAIN_TYPE_NOPS (result);
    STRIP_USELESS_TYPE_CONVERSION (result);
  
--- 2087,2090 ----
*** tree-ssa-dom.c	2 Jul 2004 00:51:00 -0000	2.20
--- tree-ssa-dom.c	2 Jul 2004 18:47:52 -0000
*************** local_fold (tree t)
*** 280,284 ****
       may have been added by fold, and "useless" type conversions that might
       now be apparent due to propagation.  */
-   STRIP_MAIN_TYPE_NOPS (t);
    STRIP_USELESS_TYPE_CONVERSION (t);
  
--- 280,283 ----
*** tree-ssa.c	30 Jun 2004 21:28:59 -0000	2.17
--- tree-ssa.c	2 Jul 2004 18:47:56 -0000
*************** tree_ssa_useless_type_conversion (tree e
*** 602,606 ****
       is "safe", then strip away the type conversion so that we can
       enter LHS = RHS into the const_and_copies table.  */
!   if (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR)
      return tree_ssa_useless_type_conversion_1 (TREE_TYPE (expr),
  					       TREE_TYPE (TREE_OPERAND (expr,
--- 602,608 ----
       is "safe", then strip away the type conversion so that we can
       enter LHS = RHS into the const_and_copies table.  */
!   if (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR
!       || TREE_CODE (expr) == VIEW_CONVERT_EXPR
!       || TREE_CODE (expr) == NON_LVALUE_EXPR)
      return tree_ssa_useless_type_conversion_1 (TREE_TYPE (expr),
  					       TREE_TYPE (TREE_OPERAND (expr,



More information about the Gcc-patches mailing list