aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-07-23 10:29:58 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2024-07-23 11:51:29 +0200
commit15d3b2dab9182eff036a604169b5e6f4ab3b2a40 (patch)
treeee916bcc5cd5da098c3d98b0b69b26e5ed104e72
parentb40156d69153364315e071dc968227ce1c3bd2a8 (diff)
downloadgcc-15d3b2dab9182eff036a604169b5e6f4ab3b2a40.zip
gcc-15d3b2dab9182eff036a604169b5e6f4ab3b2a40.tar.gz
gcc-15d3b2dab9182eff036a604169b5e6f4ab3b2a40.tar.bz2
tree-optimization/116002 - PTA solving slow with degenerate graph
When the constraint graph consists of N nodes with only complex constraints and no copy edges we have to be lucky to arrive at a constraint solving order that requires the optimal number of iterations. What happens in the testcase is that we bottle-neck on computing the visitation order but propagate changes only very slowly. Luckily the testcase complex constraints are all copy-with-offset and those do provide a way to order visitation. The following adds this which reduces the iteration count to one. PR tree-optimization/116002 * tree-ssa-structalias.cc (topo_visit): Also consider SCALAR = SCALAR complex constraints as edges.
-rw-r--r--gcc/tree-ssa-structalias.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index 330e64e..65f9132 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -1908,6 +1908,18 @@ topo_visit (constraint_graph_t graph, vec<unsigned> &topo_order,
topo_visit (graph, topo_order, visited, k);
}
+ /* Also consider copy with offset complex constraints as implicit edges. */
+ for (auto c : graph->complex[n])
+ {
+ /* Constraints are ordered so that SCALAR = SCALAR appear first. */
+ if (c->lhs.type != SCALAR || c->rhs.type != SCALAR)
+ break;
+ gcc_checking_assert (c->rhs.var == n);
+ unsigned k = find (c->lhs.var);
+ if (!bitmap_bit_p (visited, k))
+ topo_visit (graph, topo_order, visited, k);
+ }
+
topo_order.quick_push (n);
}