From a3f4b7d835009918910989ea72092a11d5b21d9f Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Sun, 31 Jul 2005 21:45:44 +0000 Subject: re PR target/23095 (ICE in regstack compensate_edge) 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. testsuite/ PR target/23095 * gfortran.dg/pr23095.f: New test. PR c++/22003 * g++.dg/other/pr22003.C: New test. From-SVN: r102610 --- gcc/ChangeLog | 7 +++++++ gcc/common.opt | 4 ++-- gcc/postreload-gcse.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/other/pr22003.C | 24 ++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/pr23095.f | 22 ++++++++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/pr22003.C create mode 100644 gcc/testsuite/gfortran.dg/pr23095.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45c082f..f20a528 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-07-31 Steven Bosscher + + 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 * pretty-print.h (pp_widest_integer): New macro. diff --git a/gcc/common.opt b/gcc/common.opt index d92a8fe..28d9a06 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -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 diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c index a0334ab..ea9c0ef7 100644 --- a/gcc/postreload-gcse.c +++ b/gcc/postreload-gcse.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49cacbb..968118f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2005-07-31 Steven Bosscher + + PR target/23095 + * gfortran.dg/pr23095.f: New test. + + PR c++/22003 + * g++.dg/other/pr22003.C: New test. + 2005-07-31 Richard Sandiford 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 index 0000000..24f5ee6 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr22003.C @@ -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 index 0000000..fe0d33d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr23095.f @@ -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 -- cgit v1.1