https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70390
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- graphite uses a strange "premature optimization" with scev_analyzable_p which seems to be confused about a degenerate IV we have in the loop. <bbN> _1 = PHI <_2, _3> _3 = _1; .... if () goto exit goto bbN; exit: _5 = PHI <_3> interestingly the copyprop pass before graphite doesn't fix this up. Ah, before copyprop we have _57 = -1; ... # prephitmp_59 = PHI <g_lsm.18_37(15), _16(6)> _16 = _57 & prephitmp_59; which SCCP introduces (during it's constant "non-"propagation, not during final value replacement). Note that copyprop doesn't visit "uninteresting" stmts (like _16 = _57 & prephitmp_59), it merely folds them at the end of propagation which figures out _57 is -1. Not sure if the GRAPHITE assert is necessary or merely a hint that some optimization didn't apply - that is, do we actually generate wrong-code if it triggers? Index: gcc/graphite-isl-ast-to-gimple.c =================================================================== --- gcc/graphite-isl-ast-to-gimple.c (revision 234449) +++ gcc/graphite-isl-ast-to-gimple.c (working copy) @@ -2112,7 +2112,7 @@ copy_loop_close_phi_args (basic_block ol if (is_gimple_reg (res) && scev_analyzable_p (res, region->region)) /* Loop close phi nodes should not be scev_analyzable_p. */ - gcc_unreachable (); + /*gcc_unreachable ()*/; gphi *new_close_phi = create_phi_node (SSA_NAME_VAR (res), new_bb); tree new_res = create_new_def_for (res, new_close_phi, @@ -2497,7 +2497,7 @@ copy_cond_phi_nodes (basic_block bb, bas continue; if (is_gimple_reg (res) && scev_analyzable_p (res, region->region)) /* Cond phi nodes should not be scev_analyzable_p. */ - gcc_unreachable (); + /*gcc_unreachable ()*/; gphi *new_phi = create_phi_node (SSA_NAME_VAR (res), new_bb); tree new_res = create_new_def_for (res, new_phi, "fixes" the ICE. Sebastian?