https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69155
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > (In reply to Richard Biener from comment #2) > > I think we have a dup/related bug where we run into the issue that > > tree-complex.c > > wrecks SSA form during its rewrite. > > That is indeed what happens, but what solution do you see other than > avoiding all the simplifications/optimizations that follow ssa edges? In the other bug we discussed to do the processing in proper (dominator) order. Richard, any progress on that? > We have: > <bb 4>: > # a_22 = PHI <a_11(4), a_18(3)> > # b_23 = PHI <b_10(4), b_17(3)> > # a$real_28 = PHI <a$real_30(4), a$real_24(3)> > # a$imag_29 = PHI <a$imag_31(4), a$imag_25(3)> > # b$real_32 = PHI <b$real_34(4), b$real_26(3)> > # b$imag_33 = PHI <b$imag_35(4), b$imag_27(3)> > _9 = __complex__ (1.0e+0, 0.0) / a_22; > b_10 = b_23 - _9; > a_11 = a_22 + __complex__ (1.0e+0, 0.0); > _8 = REALPART_EXPR <a_11>; > if (_8 < 1.0e+1) > goto <bb 4>; > else > goto <bb 5>; > > While we could avoid the crash on lowering the division by handling it last, > e.g. the addition has a loop of dependencies, so either we create a PHI > first, but then don't have definitions for its arguments, or we lower the + > first, but then we don't have definition for the PHI. We can't create all > the statements in a transaction together. > Do you suggest we set some temporary SSA_NAME_DEF_STMTs for the SSA_NAMEs we > create and we don't have a real definition yet (say GIMPLE_NOP)? No, that's somewhat gross and I like to avoid that. > Wouldn't some simplification attempt to optimize it as uninitialized? > Or stop using gimple_build* and revert to constructing it using builders > that don't actually fold anything or try to optimize anything, and when we > have everything fold all newly added statements? tree-complex.c doesn't use gimple_build but gimplify_build which simply uses fold_buildN. The issue is that the new enhanced predicates unconditionally walk SSA ... (even if the match-and-simplify machinery is instructed not to do that which it doesn't for GENERIC anyway)