This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR opt/8492


Hi,
it looks like it is safe to simply remove underachable blocks as we don't
maintain any data over the pass in basic blocks.

It fixes the testcase.  Both mainline and 3.3-branch testing in progress. OK?

Honza

 int count;

 int func(int *valp) {
   int val, locked = 0;

   while ((val = *valp) != 0) {
     if (count) {
       if (count)
         locked = 1;
       else
         locked = 1;

     if (!locked)
       continue;
     }

     if (!count)
       count--;

     break;
   }

   return val;
 }
Wed Jan 22 00:07:32 CET 2003  Jan Hubicka  <jh@suse.cz>
			      Eric Botcazou <ebotcazou@libertysurf.fr>
	PR opt/8492
	* gcse.c (one_cprop_pass): Delete unreachable blocks.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.227
diff -c -3 -p -r1.227 gcse.c
*** gcse.c	17 Jan 2003 14:24:22 -0000	1.227
--- gcse.c	21 Jan 2003 23:07:19 -0000
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.227
diff -c -3 -p -r1.227 gcse.c
*** gcse.c	17 Jan 2003 14:24:22 -0000	1.227
--- gcse.c	21 Jan 2003 23:18:19 -0000
*************** local_cprop_pass (alter_jumps)
*** 4375,4380 ****
--- 4375,4381 ----
    rtx insn;
    struct reg_use *reg_used;
    rtx libcall_stack[MAX_NESTED_LIBCALLS + 1], *libcall_sp;
+   bool changed = false;
  
    cselib_init ();
    libcall_sp = &libcall_stack[MAX_NESTED_LIBCALLS];
*************** local_cprop_pass (alter_jumps)
*** 4406,4418 ****
  		   reg_used++, reg_use_count--)
  		if (do_local_cprop (reg_used->reg_rtx, insn, alter_jumps,
  		    libcall_sp))
! 		  break;
  	    }
  	  while (reg_use_count);
  	}
        cselib_process_insn (insn);
      }
    cselib_finish ();
  }
  
  /* Forward propagate copies.  This includes copies and constants.  Return
--- 4407,4425 ----
  		   reg_used++, reg_use_count--)
  		if (do_local_cprop (reg_used->reg_rtx, insn, alter_jumps,
  		    libcall_sp))
! 		  {
! 		    changed = true;
! 		    break;
! 		  }
  	    }
  	  while (reg_use_count);
  	}
        cselib_process_insn (insn);
      }
    cselib_finish ();
+   /* Global analysis may get into infinite loops for unreachable blocks.  */
+   if (changed && alter_jumps)
+     delete_unreachable_blocks ();
  }
  
  /* Forward propagate copies.  This includes copies and constants.  Return
*************** one_cprop_pass (pass, cprop_jumps, bypas
*** 4503,4508 ****
--- 4510,4518 ----
        fprintf (gcse_file, "%d const props, %d copy props\n\n",
  	       const_prop_count, copy_prop_count);
      }
+   /* Global analysis may get into infinite loops for unreachable blocks.  */
+   if (changed && cprop_jump)
+     delete_unreachable_blocks ();
  
    return changed;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]