GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
rtlanal

rtlanal: Refine operator precedence for comparisons.

Operator precedence in rtlanal is tweaked to ensure all binary operators have higher precedence than unary operators.

The precedence of operators in rtlanal has been adjusted to ensure that all binary operators have a higher precedence than all unary operators. This change canonicalizes existing AArch64 patterns, ensuring that expressions like some binary > some unary > some other binary are correctly ordered during RTL analysis. This change affects how RTL expressions are simplified and matched during code generation.

In Details

This commit modifies the commutative_operand_precedence function in rtlanal.cc to adjust the precedence values assigned to different operators. The change ensures that binary operators (like PLUS, MINUS) have a higher precedence than unary operators (like NOT, NEG). This change affects the canonicalization of RTL expressions. For AArch64, this makes sure that certain patterns involving carry operations and comparisons are correctly ordered.

For Context

In a compiler, RTL (Register Transfer Language) is an intermediate representation used to describe the operations that need to be performed by the processor. rtlanal is the RTL analysis pass. Operator precedence determines the order in which operations are performed in an expression. This commit adjusts the precedence of operators within GCC's RTL representation to ensure that binary operators (operators that take two operands) are always evaluated before unary operators (operators that take one operand).

Filed Under: rtlanaloperator precedenceaarch64