https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80213
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- We fail to handle the final reduction loop-closed PHI because the SESE region doesn't include the BB with that PHI. Ah, so with the --param we say the inner loop alone isn't a valid SESE so we build a SESE for the outer loop directly while in the non-param case we go through merge_sese of the inner loop SESE with the outer loop one (that sounds pointless, but anyway). _This_ merge_sese adds an extra block via /* FIXME: We should remove this piece of code once canonicalize_loop_closed_ssa has been removed, because that function adds a BB with single exit. */ if (!trivially_empty_bb_p (get_exit_bb (combined))) { /* Find the first empty succ (with single exit) of combined.exit. */ basic_block imm_succ = combined.exit->dest; if (single_succ_p (imm_succ) && single_pred_p (imm_succ) && trivially_empty_bb_p (imm_succ)) combined.exit = single_succ_edge (imm_succ); else { DEBUG_PRINT (dp << "[scop-detection-fail] Discarding SCoP because " << "no single exit (empty succ) for sese exit"; print_sese (dump_file, combined)); return invalid_sese; } } which happens to be the block with the loop-closed PHI nodes. Note that canonicalize_loop_closed_ssa makes sure those are in a separate BB. I think the proper change here is to make get_sese include the BB with the LC PHI nodes anyhow. Testing fix.