public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sebastian dot pop at cri dot ensmp dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/17560] [4.0 Regression] Infinite recursion in tree-scalar-evolution with -Os
Date: Fri, 08 Oct 2004 13:03:00 -0000	[thread overview]
Message-ID: <20041008130334.17615.qmail@sourceware.org> (raw)
In-Reply-To: <20040919165202.17560.kherron+gcc@fmailbox.com>


------- Additional Comments From sebastian dot pop at cri dot ensmp dot fr  2004-10-08 13:03 -------
Subject: Re:  [4.0 Regression] Infinite recursion in tree-scalar-evolution with -Os

> It seems to me that this can definitly happen in the case of irreducible
> regions...
> 
> Honza

Then the following patch solves the problem by avoiding the analysis
of these cycles.


Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-scalar-evolution.c,v
retrieving revision 2.8
diff -c -c -3 -p -r2.8 tree-scalar-evolution.c
*** tree-scalar-evolution.c	1 Oct 2004 09:05:57 -0000	2.8
--- tree-scalar-evolution.c	8 Oct 2004 12:59:37 -0000
*************** tree chrec_dont_know;
*** 284,289 ****
--- 284,290 ----
  tree chrec_known;
  
  static bitmap already_instantiated;
+ static bitmap already_analyzed;
  
  static htab_t scalar_evolution_info;
  
*************** follow_ssa_edge_in_condition_phi (struct
*** 1398,1403 ****
--- 1399,1409 ----
  
    for (i = 1; i < PHI_NUM_ARGS (condition_phi); i++)
      {
+       /* Quickly give up when the evolution of one of the branches is
+ 	 not known.  */
+       if (*evolution_of_loop == chrec_dont_know)
+ 	return true;
+ 
        if (!follow_ssa_edge_in_condition_phi_branch (i, loop, condition_phi,
  						    halting_phi,
  						    &evolution_of_branch,
*************** analyze_scalar_evolution_1 (struct loop 
*** 1833,1838 ****
--- 1839,1853 ----
        goto set_and_end;
      }
  
+   /* Fail on irreducible CFGs.  */
+   if (bitmap_bit_p (already_analyzed, SSA_NAME_VERSION (var)))
+     {
+       res = chrec_dont_know;
+       goto set_and_end;
+     }
+   else
+     bitmap_set_bit (already_analyzed, SSA_NAME_VERSION (var));
+ 
    if (res != chrec_not_analyzed_yet)
      {
        if (loop != bb->loop_father)
*************** analyze_scalar_evolution_1 (struct loop 
*** 1870,1875 ****
--- 1885,1892 ----
  
   set_and_end:
  
+   bitmap_clear_bit (already_analyzed, SSA_NAME_VERSION (var));
+ 
    /* Keep the symbolic form.  */
    if (res == chrec_dont_know)
      res = var;
*************** scev_initialize (struct loops *loops)
*** 2450,2455 ****
--- 2467,2473 ----
    scalar_evolution_info = htab_create (100, hash_scev_info,
  				       eq_scev_info, del_scev_info);
    already_instantiated = BITMAP_XMALLOC ();
+   already_analyzed = BITMAP_XMALLOC ();
    
    initialize_scalar_evolutions_analyzer ();
  
*************** scev_finalize (void)
*** 2545,2549 ****
--- 2563,2568 ----
  {
    htab_delete (scalar_evolution_info);
    BITMAP_XFREE (already_instantiated);
+   BITMAP_XFREE (already_analyzed);
  }
  


-- 


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


  parent reply	other threads:[~2004-10-08 13:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-19 16:52 [Bug c/17560] New: Segmentation fault compiling prdtoa.c " kherron+gcc at fmailbox dot com
2004-09-19 16:53 ` [Bug c/17560] " kherron+gcc at fmailbox dot com
2004-09-19 16:55 ` kherron+gcc at fmailbox dot com
2004-09-19 19:19 ` [Bug tree-optimization/17560] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-20  2:00 ` reichelt at gcc dot gnu dot org
2004-09-20  2:02 ` reichelt at gcc dot gnu dot org
2004-09-20  2:08 ` pinskia at gcc dot gnu dot org
2004-09-27 21:29 ` pinskia at gcc dot gnu dot org
2004-10-07 18:55 ` reichelt at gcc dot gnu dot org
2004-10-07 21:31 ` pinskia at gcc dot gnu dot org
2004-10-07 22:54 ` pinskia at gcc dot gnu dot org
2004-10-08  1:16 ` [Bug tree-optimization/17560] [4.0 Regression] Infinite recursion in tree-scalar-evolution " reichelt at gcc dot gnu dot org
2004-10-08  3:27 ` pinskia at gcc dot gnu dot org
2004-10-08 12:08 ` sebastian dot pop at cri dot ensmp dot fr
2004-10-08 12:39   ` Diego Novillo
2004-10-08 12:16 ` hubicka at ucw dot cz
2004-10-08 12:39 ` dnovillo at redhat dot com
2004-10-08 13:03 ` sebastian dot pop at cri dot ensmp dot fr [this message]
2004-10-08 13:09   ` Diego Novillo
2004-10-08 13:10 ` dnovillo at redhat dot com
2004-10-08 13:22 ` rakdver at gcc dot gnu dot org
2004-10-08 13:49 ` sebastian dot pop at cri dot ensmp dot fr
2004-10-08 20:17 ` rakdver at gcc dot gnu dot org
2004-10-09  8:00 ` rakdver at gcc dot gnu dot org
2004-10-11 10:28 ` reichelt at gcc dot gnu dot org
2004-10-16 16:45 ` cvs-commit at gcc dot gnu dot org
2004-10-16 16:46 ` rakdver at gcc dot gnu dot org
2004-10-17 19:16 ` reichelt at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041008130334.17615.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).