diff options
author | Richard Biener <rguenther@suse.de> | 2023-04-17 09:22:57 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-04-17 11:02:29 +0200 |
commit | f66ae49bba7d3b8c999498a0e166c0a2f99ec61a (patch) | |
tree | 5cd4d6543a1ad6aff72fb5aa6a27a76fdaab7d0d /gcc/tree-vrp.cc | |
parent | a1f25e04b8d10bbe5dcaf98bb7e17cdaec9f169d (diff) | |
download | gcc-f66ae49bba7d3b8c999498a0e166c0a2f99ec61a.zip gcc-f66ae49bba7d3b8c999498a0e166c0a2f99ec61a.tar.gz gcc-f66ae49bba7d3b8c999498a0e166c0a2f99ec61a.tar.bz2 |
tree-optimization/109524 - ICE with VRP edge removal
VRP queues edges to process late for updating global ranges for
__builtin_unreachable. But this interferes with edge removal
from substitute_and_fold. The following deals with this by
looking up the edge with source/dest block indices which do not
become stale.
PR tree-optimization/109524
* tree-vrp.cc (remove_unreachable::m_list): Change to a
vector of pairs of block indices.
(remove_unreachable::maybe_register_block): Adjust.
(remove_unreachable::remove_and_update_globals): Likewise.
Deal with removed blocks.
* g++.dg/pr109524.C: New testcase.
Diffstat (limited to 'gcc/tree-vrp.cc')
-rw-r--r-- | gcc/tree-vrp.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index be7d06f..f4d48452 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -75,7 +75,7 @@ public: ~remove_unreachable () { m_list.release (); } void maybe_register_block (basic_block bb); bool remove_and_update_globals (bool final_p); - vec<edge> m_list; + vec<std::pair<int, int> > m_list; gimple_ranger &m_ranger; }; @@ -103,9 +103,9 @@ remove_unreachable::maybe_register_block (basic_block bb) return; if (un0) - m_list.safe_push (e1); + m_list.safe_push (std::make_pair (e1->src->index, e1->dest->index)); else - m_list.safe_push (e0); + m_list.safe_push (std::make_pair (e0->src->index, e0->dest->index)); } // Process the edges in the list, change the conditions and removing any @@ -132,7 +132,12 @@ remove_unreachable::remove_and_update_globals (bool final_p) auto_bitmap all_exports; for (i = 0; i < m_list.length (); i++) { - edge e = m_list[i]; + auto eb = m_list[i]; + basic_block src = BASIC_BLOCK_FOR_FN (cfun, eb.first); + basic_block dest = BASIC_BLOCK_FOR_FN (cfun, eb.second); + if (!src || !dest) + continue; + edge e = find_edge (src, dest); gimple *s = gimple_outgoing_range_stmt_p (e->src); gcc_checking_assert (gimple_code (s) == GIMPLE_COND); bool lhs_p = TREE_CODE (gimple_cond_lhs (s)) == SSA_NAME; |