On Mon, Apr 17, 2023 at 08:41:38AM +0000, Richard Biener wrote:
> 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.
>
> For GCC 14 we probably want to refactor substitute_and_fold but
> that doesn't seem appropriate at this stage.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
>
> Thanks,
> Richard.
>
> 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.
Ok, thanks.
> --- 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;
We are in C++11, you could use >> instead of > > here I think.
Jakub