PR optimization/12628
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Dec 2003 21:16:59 +0000 (21:16 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Dec 2003 21:16:59 +0000 (21:16 +0000)
* toplev.c (rest_of_handle_jump_bypass): Call reg_scan.
* regclass.c (reg_scan): Include allocate_reg_info time in
TV_REG_SCAN.  Minor clean-ups.
(reg_scan_update): Minor clean-ups.

* gcc.dg/20031201-1.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74125 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/regclass.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20031201-1.c [new file with mode: 0644]
gcc/toplev.c

index a5ada6d..778a7e7 100644 (file)
@@ -1,3 +1,11 @@
+2003-12-01  Roger Sayle  <roger@eyesopen.com>
+
+       PR optimization/12628
+       * toplev.c (rest_of_handle_jump_bypass): Call reg_scan.
+       * regclass.c (reg_scan): Include allocate_reg_info time in
+       TV_REG_SCAN.  Minor clean-ups.
+       (reg_scan_update): Minor clean-ups.
+
 2003-12-01  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config.gcc (s390x-ibm-tpf*): Add extra_parts.
index f16f03a..c2da744 100644 (file)
@@ -2293,21 +2293,20 @@ reg_scan (rtx f, unsigned int nregs, int repeat ATTRIBUTE_UNUSED)
 {
   rtx insn;
 
+  timevar_push (TV_REG_SCAN);
+
   allocate_reg_info (nregs, TRUE, FALSE);
   max_parallel = 3;
   max_set_parallel = 0;
 
-  timevar_push (TV_REG_SCAN);
-
   for (insn = f; insn; insn = NEXT_INSN (insn))
-    if (GET_CODE (insn) == INSN
-       || GET_CODE (insn) == CALL_INSN
-       || GET_CODE (insn) == JUMP_INSN)
+    if (INSN_P (insn))
       {
-       if (GET_CODE (PATTERN (insn)) == PARALLEL
-           && XVECLEN (PATTERN (insn), 0) > max_parallel)
-         max_parallel = XVECLEN (PATTERN (insn), 0);
-       reg_scan_mark_refs (PATTERN (insn), insn, 0, 0);
+       rtx pat = PATTERN (insn);
+       if (GET_CODE (pat) == PARALLEL
+           && XVECLEN (pat, 0) > max_parallel)
+         max_parallel = XVECLEN (pat, 0);
+       reg_scan_mark_refs (pat, insn, 0, 0);
 
        if (REG_NOTES (insn))
          reg_scan_mark_refs (REG_NOTES (insn), insn, 1, 0);
@@ -2331,14 +2330,13 @@ reg_scan_update (rtx first, rtx last, unsigned int old_max_regno)
   allocate_reg_info (max_reg_num (), FALSE, FALSE);
 
   for (insn = first; insn != last; insn = NEXT_INSN (insn))
-    if (GET_CODE (insn) == INSN
-       || GET_CODE (insn) == CALL_INSN
-       || GET_CODE (insn) == JUMP_INSN)
+    if (INSN_P (insn))
       {
-       if (GET_CODE (PATTERN (insn)) == PARALLEL
-           && XVECLEN (PATTERN (insn), 0) > max_parallel)
-         max_parallel = XVECLEN (PATTERN (insn), 0);
-       reg_scan_mark_refs (PATTERN (insn), insn, 0, old_max_regno);
+       rtx pat = PATTERN (insn);
+       if (GET_CODE (pat) == PARALLEL
+           && XVECLEN (pat, 0) > max_parallel)
+         max_parallel = XVECLEN (pat, 0);
+       reg_scan_mark_refs (pat, insn, 0, old_max_regno);
 
        if (REG_NOTES (insn))
          reg_scan_mark_refs (REG_NOTES (insn), insn, 1, old_max_regno);
index 417272f..90f5167 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-01  Roger Sayle  <roger@eyesopen.com>
+
+       PR optimization/12628
+       * gcc.dg/20031201-1.c: New test case.
+
 2003-12-01  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.dg/unaligned-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/20031201-1.c b/gcc/testsuite/gcc.dg/20031201-1.c
new file mode 100644 (file)
index 0000000..e6ea70b
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR optimization/12628 */
+/* The following test used to ICE in init_alias_analysis because the
+   given command line options meant that reg_scan wasn't (re)run before
+   the jump bypassing pass.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-expensive-optimizations -fno-rerun-loop-opt" } */
+
+int outbuf[100];
+int outcnt;
+int bi_buf;
+void send_bits(void)
+{
+    bi_buf = 0;
+    outbuf[outcnt++] = 8;
+    outbuf[outcnt++] = 8;
+    if (outcnt)
+        bi_buf = 1;
+}
+
index f31b76e..e413961 100644 (file)
@@ -2571,6 +2571,7 @@ rest_of_handle_jump_bypass (tree decl, rtx insns)
   open_dump_file (DFI_bypass, decl);
 
   cleanup_cfg (CLEANUP_EXPENSIVE);
+  reg_scan (insns, max_reg_num (), 1);
 
   if (bypass_jumps (rtl_dump_file))
     {