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

match: Removes redundant INTEGER_CST checks in widening multiply patterns.

match: Simplifies widening multiply patterns by removing redundant checks, reducing generated code size.

This commit removes redundant checks for INTEGER_CST in several widening multiply patterns within match.pd. These checks were found to be already handled by inner-most matches, making them unnecessary. The removal simplifies the generated code, resulting in a 0.2% reduction in code size (approximately 584 lines).

In Details

In match.pd, patterns like mul_hilo, mul_lolo, and mul_hihi previously included explicit checks for INTEGER_CST operands. These checks are redundant because the more specific inner patterns used by these broader matches already ensure that the operands are constants when necessary. Removing these top-level INTEGER_CST checks reduces the size of the generated pattern-matching code.

For Context
INTEGER_CST
Represents an integer constant within GCC's internal tree representation. This is a node type in the Abstract Syntax Tree (AST) or GIMPLE IR.
widening multiply
A multiplication operation where the result may require more bits than the operands. For example, multiplying two 32-bit integers can result in a 64-bit value.
pattern matching
A mechanism used in compilers to recognize specific structures or sequences of operations in the intermediate representation (IR) of the code, often used for optimization or code generation.
Filed Under: optimizationcompiler