https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97000
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #6)
> I wonder if this will work:
> ...
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index f8169eef781..79f716b9dbe 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -212,7 +212,9 @@ static void
> cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end)
> {
> if (!is_gimple_call (bb_end)
> - || !gimple_call_ctrl_altering_p (bb_end))
> + || !gimple_call_ctrl_altering_p (bb_end)
> + || (gimple_call_internal_p (bb_end)
> + && gimple_call_internal_unique_p (bb_end)))
> return;
>
> int flags = gimple_call_flags (bb_end);
> ...
Yep, that seems to do the trick.