GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
dom

DOM: Replaced problematic singularity transformation in conditional folding

DOM optimization no longer rewrites comparisons into equalities, improving loop analysis.

The Dominator (DOM) optimization pass has changed how it simplifies conditional statements. Instead of a ‘singularity’ transformation that rewrites comparisons into equalities, it now uses a simpler folding mechanism that only evaluates the conditional to a constant if possible. This change avoids a transformation that was problematic for loop analyzers and was redundant given other range analysis optimizations.

In Details

The dom_opt_dom_walker::simplify_stmt function in tree-ssa-dom.cc was renamed to fold_cond. The previous implementation performed a test_for_singularity() which could transform comparisons into equalities, a transformation deemed problematic for loop analyzers and redundant with simplify_using_ranges::simplify(). The new fold_cond function relies solely on simplify_using_ranges::fold_cond(), which folds conditionals to constants but avoids the problematic singularity transformation. Assignments are also now prevented from passing through the simplifier.

For Context
DOM
Dominator analysis is a program analysis technique used in compilers to determine the control flow relationships between basic blocks. It helps identify which blocks must execute before others, crucial for optimizations.
Conditional folding
An optimization where a conditional expression (like an if statement or a ternary operator) is evaluated at compile time if its outcome can be determined statically.
Loop analyzers
Compiler components that analyze loops to identify opportunities for optimization, such as loop unrolling, vectorization, or invariant code motion.
SSA
Static Single Assignment form. An intermediate representation where every variable is assigned a value exactly once. This simplifies many dataflow analyses, including dominator analysis.
Filed Under: domoptimizationloop analysisrefactor