]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p): Remove.
authorRichard Guenther <rguenther@suse.de>
Fri, 17 Apr 2009 12:43:02 +0000 (12:43 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 17 Apr 2009 12:43:02 +0000 (12:43 +0000)
2009-04-17  Richard Guenther  <rguenther@suse.de>

* tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p): Remove.
(record_equivalences_from_stmt): Remove useless checks and
simplifications.
* tree-ssa-pre.c (eliminate): Avoid converting a constant if
the type is already suitable.

From-SVN: r146260

gcc/ChangeLog
gcc/tree-ssa-dom.c
gcc/tree-ssa-pre.c

index 5aad48d23443d730257a065c5154bec7ea293a16..3aaa681299795a33b2fcbb1eb62dbdae533e9361 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-17  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p): Remove.
+       (record_equivalences_from_stmt): Remove useless checks and
+       simplifications.
+       * tree-ssa-pre.c (eliminate): Avoid converting a constant if
+       the type is already suitable.
+
 2009-04-17  Paolo Bonzini  <bonzini@gnu.org>
 
        * config/sh/sh.h (FUNCTION_VALUE): Fix call to sh_promote_prototypes.
index e2909e8033fe5af985f3cedc3b30eb2cb691974a..1a851fa6770473e4d89c854367720151ed9bc51d 100644 (file)
@@ -1915,26 +1915,6 @@ eliminate_redundant_computations (gimple_stmt_iterator* gsi)
   return retval;
 }
 
-/* Return true if statement GS is an assignment that peforms a useless
-   type conversion.  It is is intended to be a tuples analog of function
-   tree_ssa_useless_type_conversion.  */
-
-static bool
-gimple_assign_unary_useless_conversion_p (gimple gs)
-{
-  if (is_gimple_assign (gs)
-      && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (gs))
-          || gimple_assign_rhs_code (gs) == VIEW_CONVERT_EXPR
-          || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR))
-    {
-      tree lhs_type = TREE_TYPE (gimple_assign_lhs (gs));
-      tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (gs));
-      return useless_type_conversion_p (lhs_type, rhs_type);
-    }
-  
-  return false;
-}
-
 /* STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either
    the available expressions table or the const_and_copies table.
    Detect and record those equivalences.  */
@@ -1953,14 +1933,10 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
   lhs_code = TREE_CODE (lhs);
 
   if (lhs_code == SSA_NAME
-      && (gimple_assign_single_p (stmt)
-          || gimple_assign_unary_useless_conversion_p (stmt)))
+      && gimple_assign_single_p (stmt))
     {
       tree rhs = gimple_assign_rhs1 (stmt);
                
-      /* Strip away any useless type conversions.  */
-      STRIP_USELESS_TYPE_CONVERSION (rhs);
-
       /* If the RHS of the assignment is a constant or another variable that
         may be propagated, register it in the CONST_AND_COPIES table.  We
         do not need to record unwind data for this, since this is a true
index 1119f078b39d168ab8e79121f22bec8411e744e5..61207b2f849cac043d12ea5238cd4276551ddaeb 100644 (file)
@@ -3981,8 +3981,10 @@ eliminate (void)
                 value is constant, use that constant.  */
              if (!sprime && is_gimple_min_invariant (VN_INFO (lhs)->valnum))
                {
-                 sprime = fold_convert (TREE_TYPE (lhs),
-                                        VN_INFO (lhs)->valnum);
+                 sprime = VN_INFO (lhs)->valnum;
+                 if (!useless_type_conversion_p (TREE_TYPE (lhs),
+                                                 TREE_TYPE (sprime)))
+                   sprime = fold_convert (TREE_TYPE (lhs), sprime);
 
                  if (dump_file && (dump_flags & TDF_DETAILS))
                    {