This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lno] ICE in coalesce_abnormal_edges, at tree-outof-ssa.c:645
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Apr 2004 01:57:25 +0200
- Subject: Re: [lno] ICE in coalesce_abnormal_edges, at tree-outof-ssa.c:645
- References: <Pine.LNX.4.53.0404161555060.8230@bellatrix.tat.physik.uni-tuebingen.de> <20040417201808.GA25950@atrey.karlin.mff.cuni.cz> <408268BF.6030903@tat.physik.uni-tuebingen.de>
Hello,
> >>Testcase fetchable at
> >>http://www.tat.physik.uni-tuebingen.de/~rguenth/gcc/tramp3d-v3.cpp.gz
> >
> >
> >could you please send me (or put somewhere) the preprocessed source
> >file? I was unable to reproduce the problem.
>
> http://www.tat.physik.uni-tuebingen.de/~rguenth/gcc/tramp3d-v3.ii.gz
>
> I just verified the same problem happens if I disable leafify support,
> so you should be able to reproduce it (just using -O2 triggers it,
> -fno-tree-loop-optimize fixes it). Btw. I'm still using g++ (GCC)
> 3.5-tree-ssa-lno 20040416 (merged 20040321).
here's the fix.
Zdenek
Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.131
diff -c -3 -p -r1.1.2.131 ChangeLog.lno
*** ChangeLog.lno 18 Apr 2004 19:29:05 -0000 1.1.2.131
--- ChangeLog.lno 19 Apr 2004 23:55:54 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2004-04-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (idx_contains_abnormal_ssa_name_p,
+ contains_abnormal_ssa_name_p): New functions.
+ (find_bivs, find_bivs, find_givs_in_stmt_scev):
+ Handle ssa names occuring in abnormal phis.
+ * tree-ssa-loop-im.c (movement_possibility): Ditto.
+
2004-04-18 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (create_index_for_array_ref): Remove code under
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-ivopts.c,v
retrieving revision 1.1.2.26
diff -c -3 -p -r1.1.2.26 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 15 Apr 2004 01:01:47 -0000 1.1.2.26
--- tree-ssa-loop-ivopts.c 19 Apr 2004 23:55:54 -0000
*************** determine_biv_step (tree phi)
*** 1061,1066 ****
--- 1061,1120 ----
return step;
}
+ /* Retunrs false if INDEX is a ssa name that occurs in an
+ abnormal phi node. Callback for for_each_index. */
+
+ static bool
+ idx_contains_abnormal_ssa_name_p (tree base ATTRIBUTE_UNUSED, tree *index,
+ void *data ATTRIBUTE_UNUSED)
+ {
+ if (TREE_CODE (*index) != SSA_NAME)
+ return true;
+
+ return SSA_NAME_OCCURS_IN_ABNORMAL_PHI (*index) == 0;
+ }
+
+ /* Returns true if EXPR contains a ssa name that occurs in an
+ abnormal phi node. */
+
+ static bool
+ contains_abnormal_ssa_name_p (tree expr)
+ {
+ enum tree_code code = TREE_CODE (expr);
+ char class = TREE_CODE_CLASS (code);
+
+ if (code == SSA_NAME)
+ return SSA_NAME_OCCURS_IN_ABNORMAL_PHI (expr) != 0;
+
+ if (code == INTEGER_CST
+ || is_gimple_min_invariant (expr))
+ return false;
+
+ if (code == ADDR_EXPR)
+ return !for_each_index (&TREE_OPERAND (expr, 1),
+ idx_contains_abnormal_ssa_name_p,
+ NULL);
+
+ switch (class)
+ {
+ case '2':
+ if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 1)))
+ return true;
+
+ /* Fallthru. */
+ case '1':
+ if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 0)))
+ return true;
+
+ break;
+
+ default:
+ abort ();
+ }
+
+ return false;
+ }
+
/* Finds basic ivs. */
static bool
*************** find_bivs (struct ivopts_data *data)
*** 1072,1077 ****
--- 1126,1134 ----
for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
{
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
+ continue;
+
step = determine_biv_step (phi);
if (!step)
*************** find_bivs (struct ivopts_data *data)
*** 1081,1086 ****
--- 1138,1146 ----
continue;
base = phi_element_for_edge (phi, loop_preheader_edge (loop))->def;
+ if (contains_abnormal_ssa_name_p (base))
+ continue;
+
type = TREE_TYPE (PHI_RESULT (phi));
base = convert (type, base);
step = convert (type, step);
*************** find_givs_in_stmt_scev (struct ivopts_da
*** 1193,1198 ****
--- 1253,1261 ----
return false;
*base = CHREC_LEFT (ev);
if (tree_contains_chrecs (*base))
+ return false;
+
+ if (contains_abnormal_ssa_name_p (*base))
return false;
return true;
Index: tree-ssa-loop-im.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-im.c,v
retrieving revision 1.1.2.11
diff -c -3 -p -r1.1.2.11 tree-ssa-loop-im.c
*** tree-ssa-loop-im.c 27 Mar 2004 18:29:36 -0000 1.1.2.11
--- tree-ssa-loop-im.c 19 Apr 2004 23:55:55 -0000
*************** movement_possibility (tree stmt)
*** 167,172 ****
--- 167,176 ----
return MOVE_IMPOSSIBLE;
lhs = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (lhs) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ return MOVE_IMPOSSIBLE;
+
rhs = TREE_OPERAND (stmt, 1);
if (TREE_SIDE_EFFECTS (rhs))