jump.c (jump_optimize): If after_regscan and our transformations generate new REGs...
authorDavid S. Miller <davem@pierdol.cobaltmicro.com>
Fri, 10 Jul 1998 14:00:58 +0000 (14:00 +0000)
committerDavid S. Miller <davem@gcc.gnu.org>
Fri, 10 Jul 1998 14:00:58 +0000 (07:00 -0700)
* jump.c (jump_optimize): If after_regscan and our transformations
generate new REGs, rerun reg_scan.

From-SVN: r21052

gcc/ChangeLog
gcc/jump.c

index 3380061898a189fed41faa5421c0aec14ea24506..11ccac4aba26d3c0fae61f61b7d7bc48bfb40352 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jul 10 12:53:58 1998  David S. Miller  <davem@pierdol.cobaltmicro.com>
+
+       * jump.c (jump_optimize): If after_regscan and our transformations
+       generate new REGs, rerun reg_scan.
+
 Fri Jul 10 11:50:43 EDT 1998  Andrew MacLeod  <amacleod@cygnus.com>
 
        * config/i960/i960.c (i960_address_cost): MEMA operands with
index c582d97526a022e69ea51b69de59aac190fa6424..9956789e5aac312368f74084e43b35f733374499 100644 (file)
@@ -151,6 +151,7 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
 {
   register rtx insn, next, note;
   int changed;
+  int old_max_reg;
   int first = 1;
   int max_uid = 0;
   rtx last_insn;
@@ -591,6 +592,7 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
 
   /* Now iterate optimizing jumps until nothing changes over one pass.  */
   changed = 1;
+  old_max_reg = max_reg_num ();
   while (changed)
     {
       changed = 0;
@@ -602,6 +604,16 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
          rtx nlabel;
          int this_is_simplejump, this_is_condjump, reversep = 0;
          int this_is_condjump_in_parallel;
+
+         /* If one of our transformations has created more REGs we
+            must rerun reg_scan or else we risk missed optimizations,
+            erroneous optimizations, or even worse a crash.  */
+         if (after_regscan &&
+             old_max_reg < max_reg_num ())
+           {
+             reg_scan (f, max_reg_num (), 0);
+             old_max_reg = max_reg_num ();
+           }
 #if 0
          /* If NOT the first iteration, if this is the last jump pass
             (just before final), do the special peephole optimizations.