https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
--- Comment #42 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The patch is simple after recent cleanups:
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index f14b7e8b7e6..41fea78dc8d 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -4087,7 +4087,7 @@ pass_phiopt::execute (function *)
gphi *newphi;
if (single_pred_p (bb1)
- && !diamond_p
+ && EDGE_COUNT (merge->preds) == 2
&& (newphi = factor_out_conditional_conversion (e1, e2, phi,
arg0, arg1,
cond_stmt)))
I am putting together testcases for this right now.