https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119493
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jamborm at gcc dot gnu.org --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- 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); but that is insufficient for #c0 with -O2, instead of D.2926 = foo (D.2927); [must tail call] SR.5_16 = D.2926.n_recurses; <bb 6> [local count: 116930483]: # SR.5_22 = PHI <0(4), SR.5_16(5)> <bb 7> [local count: 354334800]: # SR.4_24 = PHI <0(3), SR.5_22(6)> <bb 8> [local count: 1073741824]: # _9 = PHI <0(2), SR.4_24(7)> D.2905.n_recurses = _9; return D.2905; we get D.2926 = foo (D.2927); [must tail call] pretmp_9 = D.2926.n_recurses; <bb 6> [local count: 116930483]: # prephitmp_1 = PHI <0(4), pretmp_9(5)> <bb 7> [local count: 354334800]: # SR.4_24 = PHI <0(3), prephitmp_1(6)> <bb 8> [local count: 1073741824]: # _4 = PHI <0(2), SR.4_24(7)> D.2905.n_recurses = _4; return D.2905; which is pretty much the same thing.