As unite () can fail we have to properly guard side-effects. The
followup patch will introduce additional failures, so be prepared.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/127758
* pta-andersen.cc (scc_visit): Do not merge when unite fails.
(find_equivalent_node): Likewise.
---
gcc/pta-andersen.cc | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gcc/pta-andersen.cc b/gcc/pta-andersen.cc
index bba34b3c9a0..e8cb77020a6 100644
--- a/gcc/pta-andersen.cc
+++ b/gcc/pta-andersen.cc
@@ -959,8 +959,8 @@ scc_visit (constraint_graph_t graph, class scc_info *si,
unsigned int n)
}
else
{
- unite (lowest_node, i);
- graph->indirect_cycles[i - FIRST_REF_NODE] = lowest_node;
+ if (unite (lowest_node, i))
+ graph->indirect_cycles[i - FIRST_REF_NODE] = lowest_node;
}
}
bitmap_set_bit (si->deleted, lowest_node);
@@ -1977,8 +1977,10 @@ find_equivalent_node (constraint_graph_t graph,
{
/* Unify the two variables since we know they are equivalent. */
if (unite (graph->eq_rep[label], node))
- unify_nodes (graph, graph->eq_rep[label], node, false);
- return graph->eq_rep[label];
+ {
+ unify_nodes (graph, graph->eq_rep[label], node, false);
+ return graph->eq_rep[label];
+ }
}
else
{
--
2.51.0