From 631b8d78b040678569701afe7e8d5de53d3fd419 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 12 Jan 2015 21:45:38 +0100 Subject: [PATCH] re PR target/64513 (ICE: in maybe_record_trace_start, at dwarf2cfi.c:2231 with -mstack-arg-probe) PR target/64513 * config/i386/i386.c (ix86_expand_prologue): Add REG_FRAME_RELATED_EXPR to %rax and %r10 pushes. * gcc.target/i386/pr64513.c: New test. From-SVN: r219492 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.c | 8 ++++++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr64513.c | 17 +++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr64513.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9d47cf84dc..4a21711b41a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2015-01-12 Jakub Jelinek + PR target/64513 + * config/i386/i386.c (ix86_expand_prologue): Add + REG_FRAME_RELATED_EXPR to %rax and %r10 pushes. + PR tree-optimization/64454 * tree-vrp.c (simplify_div_or_mod_using_ranges): Optimize op0 % op1 into op0 if op0 is in range [-op1 + 1, op1 - 1] diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8724ea36cf4..7a39f800d89 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11559,6 +11559,10 @@ ix86_expand_prologue (void) if (sp_is_cfa_reg) m->fs.cfa_offset += UNITS_PER_WORD; RTX_FRAME_RELATED_P (insn) = 1; + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (Pmode, stack_pointer_rtx, + -UNITS_PER_WORD))); } } @@ -11572,6 +11576,10 @@ ix86_expand_prologue (void) if (sp_is_cfa_reg) m->fs.cfa_offset += UNITS_PER_WORD; RTX_FRAME_RELATED_P (insn) = 1; + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (Pmode, stack_pointer_rtx, + -UNITS_PER_WORD))); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a07ada5235..1b441e492da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2015-01-12 Jakub Jelinek + PR target/64513 + * gcc.target/i386/pr64513.c: New test. + PR tree-optimization/64454 * gcc.dg/pr64454.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr64513.c b/gcc/testsuite/gcc.target/i386/pr64513.c new file mode 100644 index 00000000000..02364960999 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64513.c @@ -0,0 +1,17 @@ +/* PR target/64513 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mstack-arg-probe" } */ + +struct A {}; +struct B { struct A y; }; +int foo (struct A); + +int +bar (int x) +{ + struct B b; + int c; + while (x--) + c = foo (b.y); + return c; +} -- 2.30.2