From: jakub Date: Thu, 19 Nov 2015 08:30:19 +0000 (+0000) Subject: PR target/67770 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3a4338e085ab8b08a46ca25db909faa6df9e37c;p=thirdparty%2Fgcc.git PR target/67770 * config/i386/i386.md (simple_return): Disable if ix86_static_chain_on_stack is true. * gcc.target/i386/pr67770.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230593 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f37ad250cb49..3ba93271b811 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-19 Jakub Jelinek + + PR target/67770 + * config/i386/i386.md (simple_return): Disable if + ix86_static_chain_on_stack is true. + 2015-11-19 Richard Sandiford PR bootstrap/68393 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 39b058f82c74..4c5e22aa7198 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -12203,10 +12203,14 @@ ;; We need to disable this for TARGET_SEH, as otherwise ;; shrink-wrapped prologue gets enabled too. This might exceed ;; the maximum size of prologue in unwind information. +;; Also disallow shrink-wrapping if using stack slot to pass the +;; static chain pointer - the first instruction has to be pushl %esi +;; and it can't be moved around, as we use alternate entry points +;; in that case. (define_expand "simple_return" [(simple_return)] - "!TARGET_SEH" + "!TARGET_SEH && !ix86_static_chain_on_stack" { if (crtl->args.pops_args) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48f536fc6105..8c7746ff7294 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-19 Jakub Jelinek + + PR target/67770 + * gcc.target/i386/pr67770.c: New test. + 2015-11-18 Jeff Law PR tree-optimization/68198 diff --git a/gcc/testsuite/gcc.target/i386/pr67770.c b/gcc/testsuite/gcc.target/i386/pr67770.c new file mode 100644 index 000000000000..3826aff45b74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67770.c @@ -0,0 +1,40 @@ +/* PR target/67770 */ +/* { dg-do run { target ia32 } } */ +/* { dg-require-effective-target trampolines } */ +/* { dg-options "-O2" } */ + +#ifndef NO_TRAMPOLINES +__attribute__ ((noinline)) void +foo (int i, void (* __attribute__ ((regparm (3))) bar) (int)) +{ + bar (i); +} +#endif + +int +main () +{ +#ifndef NO_TRAMPOLINES + int p = 0; + + __attribute__ ((regparm (3), noinline)) void + bar (int i) + { + if (__builtin_expect (i, 0)) + ++p; + } + + foo (0, bar); + bar (0); + + if (p != 0) + __builtin_abort (); + + foo (1, bar); + bar (1); + + if (p != 2) + __builtin_abort (); +#endif + return 0; +}