The following patch (the 2nd hunk actually) brings down compile-time
for the testcase in the PR from <unknown, not terminated after
several minutes> to 0.5s.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2016-04-14  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/70614
        * tree-scalar-evolution.c (analyze_evolution_in_loop): Terminate
        loop if the evolution dropped to chrec_dont_know.
        (interpret_condition_phi): Likewise.

Index: gcc/tree-scalar-evolution.c
===================================================================
*** gcc/tree-scalar-evolution.c (revision 234970)
--- gcc/tree-scalar-evolution.c (working copy)
*************** analyze_evolution_in_loop (gphi *loop_ph
*** 1510,1515 ****
--- 1510,1518 ----
        /* When there are multiple back edges of the loop (which in fact never
         happens currently, but nevertheless), merge their evolutions.  */
        evolution_function = chrec_merge (evolution_function, ev_fn);
+ 
+       if (evolution_function == chrec_dont_know)
+       break;
      }
  
    if (dump_file && (dump_flags & TDF_SCEV))
*************** interpret_condition_phi (struct loop *lo
*** 1687,1692 ****
--- 1690,1697 ----
        (loop, PHI_ARG_DEF (condition_phi, i));
  
        res = chrec_merge (res, branch_chrec);
+       if (res == chrec_dont_know)
+       break;
      }
  
    return res;

Reply via email to