The following part of r126198 causes a 5% slowdown of tramp3d for the
non-leafify
tests (with leafify it makes it run faster):

2007-07-02  Richard Guenther  <[EMAIL PROTECTED]>

        * fold-const.c (fold_convert): Revert fix for PR15988. 
        * tree-inline.c (setup_one_parameter): Instead fix it here by
        using fold_build1 instead of fold_convert and checking for
        error_mark_node.  Convert only if the conversion is necessary.

Index: fold-const.c
===================================================================
--- fold-const.c        (revision 126197)
+++ fold-const.c        (revision 126198)
@@ -2262,9 +2262,7 @@ fold_convert (tree type, tree arg)
       || TREE_CODE (orig) == ERROR_MARK)
     return error_mark_node;

-  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig)
-      || lang_hooks.types_compatible_p (TYPE_MAIN_VARIANT (type),
-                                       TYPE_MAIN_VARIANT (orig)))
+  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
     return fold_build1 (NOP_EXPR, type, arg);

   switch (TREE_CODE (type))
Index: tree-inline.c
===================================================================
--- tree-inline.c       (revision 126197)
+++ tree-inline.c       (revision 126198)
@@ -1278,10 +1278,15 @@ setup_one_parameter (copy_body_data *id,
   tree init_stmt;
   tree var;
   tree var_sub;
-  tree rhs = value ? fold_convert (TREE_TYPE (p), value) : NULL;
+  tree rhs = value;
   tree def = (gimple_in_ssa_p (cfun)
              ? gimple_default_def (id->src_cfun, p) : NULL);

+  if (value
+      && value != error_mark_node
+      && !useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value)))
+    rhs = fold_build1 (NOP_EXPR, TREE_TYPE (p), value);
+  
   /* If the parameter is never assigned to, has no SSA_NAMEs created,
      we may not need to create a new variable here at all.  Instead, we may
      be able to just use the argument value.  */


I am investigating why.


-- 
           Summary: [4.3 Regression] r126198 causes tramp3d slowdown w/o
                    leafify
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: rguenth at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32624

Reply via email to