GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization Performance Win

Prevent PTA quadratic compile-time with artificial variables

Fixes quadratic compile-time in PTA by preventing artificial variables from merging.

A performance issue causing quadratic compile-time in Points-To Analysis (PTA) has been resolved by preventing the merging of artificial variables. Previously, when constraints were ordered such that an ESCAPED variable was unified with a regular variable, it could lead to is_artificial_var handling being dropped and ESCAPED results bleeding into unrelated analyses, causing excessive computation. Refusing to merge artificial variables into others resolves this quadratic behavior.

In Details

This commit addresses PR tree-optimization/127758 by modifying pta-andersen.cc. The unite function is updated to refuse merging an artificial variable into another. This prevents a quadratic compile-time blowup that occurred when ESCAPED variables (which are artificial) were merged with regular variables. Such merges incorrectly dropped is_artificial_var checks, leading to ESCAPED information being propagated widely and causing excessive constraint generation and unification.

For Context
PTA
Points-To Analysis. A static analysis technique used to determine, for each pointer in a program, the set of memory locations that the pointer might possibly refer to. This helps in understanding aliasing and enabling optimizations.
artificial variable
In the context of PTA, an artificial variable is a placeholder used to represent a set of points-to information, often for intermediate or complex analysis results that don't directly map to a program variable.
ESCAPED
In PTA, a variable is considered 'escaped' if its address is taken and potentially used outside its current scope, implying it might be accessed indirectly or via pointers.
quadratic compile-time
A situation where the time taken by the compiler to compile a program grows proportionally to the square of the program's size or complexity. This can lead to very long compilation times for large projects.
unify
In the context of constraint-based analysis like PTA, 'unify' refers to merging or equating two sets of points-to information, indicating that they must refer to the same set of locations.
Filed Under: optimizationptacompile-timeperformance