https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119493
--- Comment #15 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #12)
> For musttail, perhaps SRA could avoid changing the path from musttail call
> return to the return stmt.
> I've tried
> --- gcc/tree-sra.cc.jj 2025-01-02 11:23:27.527363147 +0100
> +++ gcc/tree-sra.cc 2025-03-31 09:28:36.535135797 +0200
> @@ -1668,9 +1668,11 @@ scan_function (void)
> t = gimple_call_lhs (stmt);
> if (t && !disqualify_if_bad_bb_terminating_stmt (stmt, t, NULL))
> {
> + if (gimple_call_must_tail_p (as_a <gcall *> (stmt)))
> + disqualify_base_of_expr (t, "result of musttail call.");
> /* If the STMT is a call to DEFERRED_INIT, avoid setting
> cannot_scalarize_away_bitmap. */
> - if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT))
> + else if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT))
> ret |= !!build_access_from_expr_1 (t, stmt, true);
> else
> ret |= build_access_from_expr (t, stmt, true);
No objections from me, the above looks reasonable.