https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122225
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> I suspect, the fix is simple as rejecting RESULT_DECL SSA_NAMEs in
> may_propagate_copy for dest. If I get some time I will test that out.
>
> That should prevent ret_2 from being replaced with _13 in DOM.
Yes that fixed it.
That is this patch:
```
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index 872f881b644..ca16eb468bc 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -1083,6 +1083,10 @@ may_propagate_copy (tree dest, tree orig, bool
dest_not_abnormal_phi_edge_p)
if (TREE_CODE (dest) == SSA_NAME && virtual_operand_p (dest))
return false;
+ if (TREE_CODE (dest) == SSA_NAME
+ && SSA_NAME_VAR (dest) && TREE_CODE (SSA_NAME_VAR (dest)) ==
RESULT_DECL)
+ return false;
+
/* Keep lhs of [[gnu::musttail]] calls as is, those need to be still
tail callable. */
if (TREE_CODE (dest) == SSA_NAME
[apinski@xeond2 gcc]$
```
Fixes the ICE.
I should have a chance to test this next month if someone does not beat me to
ti.