This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81373] [7/8 Regression] Graphite ICE in ssa_default_def at gcc/tree-dfa.c:305
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 Sep 2017 14:03:30 +0000
- Subject: [Bug tree-optimization/81373] [7/8 Regression] Graphite ICE in ssa_default_def at gcc/tree-dfa.c:305
- Auto-submitted: auto-generated
- References: <bug-81373-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81373
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following patch fixes this. We fail to handle scev_analyzable_p
loop-closed
PHIs that are live-out to the region.
Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c (revision 252968)
+++ gcc/graphite-scop-detection.c (working copy)
@@ -1717,17 +1717,20 @@ build_cross_bb_scalars_def (scop_p scop,
if (!def || !is_gimple_reg (def))
return;
- /* Do not gather scalar variables that can be analyzed by SCEV as they can
be
- generated out of the induction variables. */
- if (scev_analyzable_p (def, scop->scop_info->region))
- return;
+ bool scev_analyzable = scev_analyzable_p (def, scop->scop_info->region);
gimple *use_stmt;
imm_use_iterator imm_iter;
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
- if ((def_bb != gimple_bb (use_stmt) && !is_gimple_debug (use_stmt))
- /* PHIs have their effect at "BBs" on the edges. See PR79622. */
- || gimple_code (SSA_NAME_DEF_STMT (def)) == GIMPLE_PHI)
+ /* Do not gather scalar variables that can be analyzed by SCEV as they can
+ be generated out of the induction variables. */
+ if ((! scev_analyzable
+ /* But gather SESE liveouts as we otherwise fail to rewrite their
+ exit PHIs. */
+ || ! bb_in_sese_p (gimple_bb (use_stmt), scop->scop_info->region))
+ && ((def_bb != gimple_bb (use_stmt) && !is_gimple_debug (use_stmt))
+ /* PHIs have their effect at "BBs" on the edges. See PR79622. */
+ || gimple_code (SSA_NAME_DEF_STMT (def)) == GIMPLE_PHI))
{
writes->safe_push (def);
DEBUG_PRINT (dp << "Adding scalar write: ";