------- Comment #10 from pinskia at gcc dot gnu dot org  2006-09-04 02:58 
-------
What about this (which makes us not call fold unless we really need to):
Index: pt.c
===================================================================
--- pt.c        (revision 116671)
+++ pt.c        (working copy)
@@ -10631,10 +10631,15 @@ unify (tree tparms, tree targs, tree par
             not an integer constant.  */
          if (TREE_CODE (parm_max) == MINUS_EXPR)
            {
-             arg_max = fold_build2 (PLUS_EXPR,
-                                    integer_type_node,
-                                    arg_max,
-                                    TREE_OPERAND (parm_max, 1));
+             if (TREE_CODE (arg_max) == MINUS_EXPR
+                 && simple_cst_equal (TREE_OPERAND (arg_max, 1),
+                                      TREE_OPERAND (parm_max, 1)))
+               arg_max = TREE_OPERAND (arg_max, 0);
+             else
+               arg_max = fold_build2 (PLUS_EXPR,
+                                      integer_type_node,
+                                      arg_max,
+                                      TREE_OPERAND (parm_max, 1));
              parm_max = TREE_OPERAND (parm_max, 0);
            }

Though I wonder if the fold is even needed.  I am testing a couple of testcase
and see if it is.


-- 


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

Reply via email to