Message ID | 20150112202604.GT1405@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 01/12/15 13:26, Jakub Jelinek wrote: > Hi! > > For -mstack-arg-probe we push %rax and/or %r10 in the prologue, and > mark that insn as RTX_FRAME_RELATED_P. But that means that the dwarf2 pass > also considers that the %rax/%r10 registers, which are call used, to be > saved in the unwind info, but they are never restored, which makes the > dwarf2 pass ICE on it. Fixed by letting the dwarf2 pass know just that > those instructions decrease stack pointer. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2015-01-12 Jakub Jelinek <jakub@redhat.com> > > 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. OK. jeff
--- gcc/config/i386/i386.c.jj 2015-01-09 22:00:02.000000000 +0100 +++ gcc/config/i386/i386.c 2015-01-12 17:13:21.342463547 +0100 @@ -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))); } } --- gcc/testsuite/gcc.target/i386/pr64513.c.jj 2015-01-12 17:20:12.052330807 +0100 +++ gcc/testsuite/gcc.target/i386/pr64513.c 2015-01-12 17:20:02.000000000 +0100 @@ -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; +}