GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
match

Combine loops in genmatch for reduced C++ output

Simplifies genmatch by combining loops, reducing generated C++ code size.

This commit refactors the genmatch tool by combining four separate loops into a single loop. This optimization reduces the amount of generated C++ code, making the output more compact. Additionally, it ensures that the fourth loop is correctly enclosed within an INTEGRAL_TYPE_P check, resolving a syntactic issue with an extra closing parenthesis in the third loop.

In Details

The match.pd file is processed by genmatch to generate C++ code for pattern matching. This change consolidates four loops involved in iterating over types or properties into a single loop. This is achieved by merging loop conditions and bodies. The change also corrects a minor syntax error in the original structure, ensuring proper C++ code generation and potentially improving the efficiency of the generated matching code.

For Context
genmatch
A tool within GCC that generates C++ code for pattern matching based on specifications in .pd files. This code is used in various compiler passes.
PR59429
A bug report identifier (Problem Report) in the GCC bug tracking system. This commit addresses an issue filed under this number.
INTEGRAL_TYPE_P
A predicate or macro used to determine if a given GCC tree type represents an integral type (e.g., int, long, char).
Filed Under: optimizationcode generationrefactor