Add guards to PTA unit() calls
Improves PTA stability by guarding side effects when unit() calls can fail.
The Points-To Analysis (PTA) unit() function can fail, and this commit ensures that side effects are properly guarded against such failures. This change prepares the analysis for upcoming patches that will introduce more failure conditions in unit(), thus maintaining the stability and correctness of PTA even when certain unification operations do not succeed.
In Details
This change, part of addressing PR tree-optimization/127758, modifies pta-andersen.cc to handle potential failures in unite() and find_equivalent_node. When unite() fails (e.g., due to merging artificial variables, as fixed in a related commit), the subsequent side effects in scc_visit and find_equivalent_node must be skipped. This commit adds the necessary guards to prevent incorrect state updates or crashes when unification attempts do not succeed, ensuring robustness for future PTA enhancements.
- 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.
- unit()
- In the context of PTA, this likely refers to a function that attempts to unify or merge sets of points-to information. Failures in this operation can occur if the unification is impossible or leads to contradictions.
- side-effects
- Actions performed by a function or operation that alter the state of the program beyond simply returning a value. In analysis, uncontrolled side-effects after a failed operation can corrupt the analysis state.
- scc_visit
- Likely a function within the PTA implementation that traverses Strongly Connected Components (SCCs) of the program's control flow graph to propagate points-to information.
- find_equivalent_node
- A function within the PTA implementation that attempts to find or merge equivalent nodes or sets of points-to information.