https://gcc.gnu.org/g:d56633c724c52910db102ecd314069af4243fa4d

commit r17-4995-gd56633c724c52910db102ecd314069af4243fa4d
Author: Richard Biener <[email protected]>
Date:   Thu Oct 8 13:05:57 2026 +0200

    tree-optimization/127758 - PTA quadraticness
    
    The following addresses PTA quadratic compile-time in basically
    random cases, namely if constraints are ordered in a way that
    we unify ESCAPED to a regular variable.  That drops is_artificial_var
    handling from solving and bleeds the ESCAPED results everywhere.
    Simply refuse merging artificial vars elsewhere.
    
            PR tree-optimization/127758
            * pta-andersen.cc (unite): Refuse to merge an artificial
            variable into another.

Diff:
---
 gcc/pta-andersen.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/pta-andersen.cc b/gcc/pta-andersen.cc
index e8cb77020a68..464c54b3f766 100644
--- a/gcc/pta-andersen.cc
+++ b/gcc/pta-andersen.cc
@@ -149,7 +149,11 @@ static bool
 unite (unsigned int to, unsigned int from)
 {
   gcc_checking_assert (to < graph->size && from < graph->size);
-  if (to != from && graph->rep[from] != to)
+  if (to != from
+      && graph->rep[from] != to
+      /* Do not merge an artificial variable into another, this will
+        explode solution sets unnecessarily.  */
+      && (from >= FIRST_REF_NODE || !get_varinfo (from)->is_artificial_var))
     {
       graph->rep[from] = to;
       return true;

Reply via email to