On 12/7/23 00:11, Ken Matsui wrote:
This patch series optimizes type traits compilation performance by
implementing built-in type traits and using them in libstdc++.
Changes in v26:
* Rebased on top of trunk.
* Moved is_function_v under is_const_v.
* Isolated patches for is_const, is_volatile, is_pointer, and
is_unbounded_array, which contain performance regression, from
this patch series since they are not ready for review yet.
I've applied all the compiler patches, with a few small tweaks,
including this one as a separate commit. One other was a formatting
fix, the lats was using TYPE_PTRDATAMEM_P for CPTK_IS_MEMBER_OBJECT_POINTER.
I'm leaving the library patches for library folks to apply.
Thanks!
Jason
From e410303f768fa7b020e46f3bd7d28381144e5340 Mon Sep 17 00:00:00 2001
From: Jason Merrill <ja...@redhat.com>
Date: Fri, 8 Dec 2023 15:55:49 -0500
Subject: [PATCH 01/11] c++: trait patch tweak
To: gcc-patches@gcc.gnu.org
As Patrick suggested elsewhere, let's move this into the default case.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_simple_type_specifier): Move trait
handling to default label.
---
gcc/cp/parser.cc | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 9e76426566b..b987324f669 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -20164,22 +20164,22 @@ cp_parser_simple_type_specifier (cp_parser* parser,
return type;
default:
+ /* If token is a type-yielding built-in traits, parse it. */
+ const cp_trait* trait = cp_lexer_peek_trait_type (parser->lexer);
+ if (trait)
+ {
+ type = cp_parser_trait (parser, trait);
+ if (decl_specs)
+ cp_parser_set_decl_spec_type (decl_specs, type,
+ token,
+ /*type_definition_p=*/false);
+
+ return type;
+ }
+
break;
}
- /* If token is a type-yielding built-in traits, parse it. */
- const cp_trait* trait = cp_lexer_peek_trait_type (parser->lexer);
- if (trait)
- {
- type = cp_parser_trait (parser, trait);
- if (decl_specs)
- cp_parser_set_decl_spec_type (decl_specs, type,
- token,
- /*type_definition_p=*/false);
-
- return type;
- }
-
/* If token is an already-parsed decltype not followed by ::,
it's a simple-type-specifier. */
if (token->type == CPP_DECLTYPE
--
2.39.3