------- Comment #2 from rguenth at gcc dot gnu dot org  2009-05-08 09:47 -------
The issue is that with follow_ssa_edge_in_condition_phi we end up with
exponential time and space complexity because we have several PHI nodes
in our chain that have a large number of PHI arguments.

The following fixes it

Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c     (revision 147237)
+++ tree-scalar-evolution.c     (working copy)
@@ -1320,10 +1320,12 @@ follow_ssa_edge_in_condition_phi (struct

   *evolution_of_loop = evolution_of_branch;

-  /* If the phi node is just a copy, do not increase the limit.  */
+  /* If the phi node is just a copy, do not increase the limit, otherwise
+     increase it by the number of PHI arguments to avoid exponential
+     complexity.  */
   n = gimple_phi_num_args (condition_phi);
-  if (n > 1)
-    limit++;
+  limit += n - 1;
+

   for (i = 1; i < n; i++)
     {


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spop at gcc dot gnu dot org
   Target Milestone|---                         |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40062

Reply via email to