diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a9cee9a7ee..21c516c59dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2002-03-30 Richard Henderson + + PR target/5446 + * config/ia64/ia64.c (group_barrier_needed_p): Special case + prologue_allocate_stack. + (ia64_single_set): Use insn codes for recognition of special + cases, not rtl matching. + * config/ia64/ia64.md (prologue_allocate_stack): Op 3 is in-out. + Sat Mar 30 23:48:41 CET 2002 Jan Hubicka * cfgbuild.c (find_basic_blocks_1): Clear aux for blocks. diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 78ba70e1e85..74cbf813ca4 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -4764,6 +4764,7 @@ group_barrier_needed_p (insn) /* We play dependency tricks with the epilogue in order to get proper schedules. Undo this for dv analysis. */ case CODE_FOR_epilogue_deallocate_stack: + case CODE_FOR_prologue_allocate_stack: pat = XVECEXP (pat, 0, 0); break; @@ -5235,21 +5236,22 @@ ia64_single_set (insn) x = COND_EXEC_CODE (x); if (GET_CODE (x) == SET) return x; - ret = single_set_2 (insn, x); - if (ret == NULL && GET_CODE (x) == PARALLEL) + + /* Special case here prologue_allocate_stack and epilogue_deallocate_stack. + Although they are not classical single set, the second set is there just + to protect it from moving past FP-relative stack accesses. */ + switch (recog_memoized (insn)) { - /* Special case here prologue_allocate_stack and - epilogue_deallocate_stack. Although it is not a classical - single set, the second set is there just to protect it - from moving past FP-relative stack accesses. */ - if (XVECLEN (x, 0) == 2 - && GET_CODE (XVECEXP (x, 0, 0)) == SET - && GET_CODE (XVECEXP (x, 0, 1)) == SET - && GET_CODE (SET_DEST (XVECEXP (x, 0, 1))) == REG - && SET_DEST (XVECEXP (x, 0, 1)) == SET_SRC (XVECEXP (x, 0, 1)) - && ia64_safe_itanium_class (insn) == ITANIUM_CLASS_IALU) - ret = XVECEXP (x, 0, 0); + case CODE_FOR_prologue_allocate_stack: + case CODE_FOR_epilogue_deallocate_stack: + ret = XVECEXP (x, 0, 0); + break; + + default: + ret = single_set_2 (insn, x); + break; } + return ret; } diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index 8b134a67874..a7d7dcaab74 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -4848,7 +4848,7 @@ [(set (match_operand:DI 0 "register_operand" "=r,r,r") (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a") (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J"))) - (set (match_operand:DI 3 "register_operand" "=r,r,r") + (set (match_operand:DI 3 "register_operand" "+r,r,r") (match_dup 3))] "" "@ diff --git a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c new file mode 100644 index 00000000000..cac7099127f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c @@ -0,0 +1,27 @@ +/* PR 5446 */ +/* This testcase is similar to gcc.c-torture/compile/20011219-1.c except + with parts of it omitted, causing an ICE with -O3 on IA-64. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); +}