This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Micro optimize for_each_template_parm
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Jan 2004 00:17:14 +0100 (CET)
- Subject: [PATCH] Micro optimize for_each_template_parm
Hi!
This would strip some for_each_template_parm() calls in some cases.
Bootstrap running.
Richard.
2004Jan22 Richard Guenther <richard.guenther@uni-tuebingen.de>
cp/pt.c: (tsubst) check uses_template_parms last.
(type_unification_real) likewise.
Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.816.2.2
diff -u -c -3 -p -r1.816.2.2 pt.c
*** pt.c 19 Jan 2004 20:39:33 -0000 1.816.2.2
--- pt.c 21 Jan 2004 23:08:48 -0000
*************** tsubst (tree t, tree args, tsubst_flags_
*** 7008,7014 ****
ctx);
return error_mark_node;
}
! else if (!uses_template_parms (ctx) && !TYPE_BEING_DEFINED (ctx))
{
/* Normally, make_typename_type does not require that the CTX
have complete type in order to allow things like:
--- 6999,7005 ----
ctx);
return error_mark_node;
}
! else if (!TYPE_BEING_DEFINED (ctx) && !uses_template_parms (ctx))
{
/* Normally, make_typename_type does not require that the CTX
have complete type in order to allow things like:
*************** type_unification_real (tree tparms,
*** 9031,9039 ****
deduced from a later argument than the one from which
this parameter can be deduced. */
if (TREE_CODE (tparm) == PARM_DECL
! && uses_template_parms (TREE_TYPE (tparm))
! && !saw_undeduced++)
! goto again;
if (!allow_incomplete)
error ("incomplete type unification");
--- 9022,9030 ----
deduced from a later argument than the one from which
this parameter can be deduced. */
if (TREE_CODE (tparm) == PARM_DECL
! && !saw_undeduced
! && uses_template_parms (TREE_TYPE (tparm)))
! ++saw_undeduced, goto again;
if (!allow_incomplete)
error ("incomplete type unification");