PR target/23095
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Jul 2005 21:45:44 +0000 (21:45 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Jul 2005 21:45:44 +0000 (21:45 +0000)
* common.opt (flag_gcse_after_reload): Don't initialize to 2.
(flag_rerun_cse_after_loop): Initialize this to 2 instead.
* postreload-gcse.c (hash_scan_set): Do not consider stack regs.

testsuite/
PR target/23095
* gfortran.dg/pr23095.f: New test.

PR c++/22003
* g++.dg/other/pr22003.C: New test.

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

gcc/ChangeLog
gcc/common.opt
gcc/postreload-gcse.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/pr22003.C [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr23095.f [new file with mode: 0644]

index 45c082f..f20a528 100644 (file)
@@ -1,3 +1,10 @@
+2005-07-31  Steven Bosscher  <stevenb@suse.de>
+
+       PR target/23095
+       * common.opt (flag_gcse_after_reload): Don't initialize to 2.
+       (flag_rerun_cse_after_loop): Initialize this to 2 instead.
+       * postreload-gcse.c (hash_scan_set): Do not consider stack regs.
+
 2005-07-31  Jan Hubicka  <jh@suse.cz>
 
        * pretty-print.h (pp_widest_integer): New macro.
index d92a8fe..28d9a06 100644 (file)
@@ -435,7 +435,7 @@ Perform redundant load after store elimination in global common subexpression
 elimination
 
 fgcse-after-reload
-Common Report Var(flag_gcse_after_reload) Init(2)
+Common Report Var(flag_gcse_after_reload)
 Perform global common subexpression elimination after register allocation
 has finished
 
@@ -694,7 +694,7 @@ Common Report Var(flag_reorder_functions)
 Reorder functions to improve code placement
 
 frerun-cse-after-loop
-Common Report Var(flag_rerun_cse_after_loop)
+Common Report Var(flag_rerun_cse_after_loop) Init(2)
 Add a common subexpression elimination pass after loop optimizations
 
 frerun-loop-opt
index a0334ab..ea9c0ef 100644 (file)
@@ -745,6 +745,12 @@ hash_scan_set (rtx insn)
          can_copy_p (GET_MODE (dest))
          /* Is SET_SRC something we want to gcse?  */
          && general_operand (src, GET_MODE (src))
+#ifdef STACK_REGS
+         /* Never consider insns touching the register stack.  It may
+            create situations that reg-stack cannot handle (e.g. a stack
+            register live across an abnormal edge).  */
+         && (REGNO (dest) < FIRST_STACK_REG || REGNO (dest) > LAST_STACK_REG)
+#endif
          /* An expression is not available if its operands are
             subsequently modified, including this insn.  */
          && oprs_unchanged_p (src, insn, true))
@@ -759,6 +765,10 @@ hash_scan_set (rtx insn)
          can_copy_p (GET_MODE (src))
          /* Is SET_DEST something we want to gcse?  */
          && general_operand (dest, GET_MODE (dest))
+#ifdef STACK_REGS
+         /* As above for STACK_REGS.  */
+         && (REGNO (src) < FIRST_STACK_REG || REGNO (src) > LAST_STACK_REG)
+#endif
          && ! (flag_float_store && FLOAT_MODE_P (GET_MODE (dest)))
          /* Check if the memory expression is killed after insn.  */
          && ! load_killed_in_block_p (INSN_CUID (insn) + 1, dest, true)
index 49cacbb..968118f 100644 (file)
@@ -1,3 +1,11 @@
+2005-07-31  Steven Bosscher  <stevenb@suse.de>
+
+       PR target/23095
+       * gfortran.dg/pr23095.f: New test.
+
+       PR c++/22003
+       * g++.dg/other/pr22003.C: New test.
+
 2005-07-31  Richard Sandiford  <richard@codesourcery.com>
 
        PR target/20621
diff --git a/gcc/testsuite/g++.dg/other/pr22003.C b/gcc/testsuite/g++.dg/other/pr22003.C
new file mode 100644 (file)
index 0000000..24f5ee6
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/22003 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-exceptions -freorder-blocks-and-partition" } */
+
+struct c1
+{
+      virtual ~c1();
+};
+class c4;
+
+struct c2
+{
+      virtual c4* func();
+};
+
+struct c3 : c1, c2
+{
+      c4* func();
+};
+
+c4* c3::func()
+{
+}
+
diff --git a/gcc/testsuite/gfortran.dg/pr23095.f b/gcc/testsuite/gfortran.dg/pr23095.f
new file mode 100644 (file)
index 0000000..fe0d33d
--- /dev/null
@@ -0,0 +1,22 @@
+      ! { dg-do compile { target i?86-*-* x86_64-*-* } }
+      ! { dg-options "-w -m32 -O2 -ffloat-store -fgcse-after-reload" }
+      !
+      ! GCSE after reload made a stack register live across an abnormal
+      ! edges for one of the computed jumps.  This bombed in reg-stack.
+      function foo(n) 
+      real*8 foo 
+      integer ix, n, next 
+      real*8 xmax, absx 
+      foo  = 0.0d0 
+      assign 20 to next 
+      do ix = 1,n 
+         go to next,(10, 30) 
+   10    assign 40 to next 
+         go to 40 
+   20    if (absx .gt. 8.232d-11) go to 40 
+   30    if (absx .le. xmax) go to 40 
+         xmax = absx 
+   40    go to next,(10, 30) 
+      end do 
+      return 
+      end