re PR target/40718 (Invalid code produced with -foptimize-sibling-calls)

PR target/40718
	* config/i386/i386.c (*call_pop_1): Disable for sibling calls.
	(*sibcall_pop_1): New insn pattern.

testsuite/ChangeLog:

	PR target/40718
	* gcc.target/i386/pr40718.c: New test.

From-SVN: r151028
This commit is contained in:
Uros Bizjak 2009-08-23 11:46:00 +02:00
parent 98791cfdb3
commit 8c40d061ec
4 changed files with 71 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2009-08-23 Uros Bizjak <ubizjak@gmail.com>
PR target/40718
* config/i386/i386.c (*call_pop_1): Disable for sibling calls.
(*sibcall_pop_1): New insn pattern.
2009-08-23 Alan Modra <amodra@bigpond.net.au>
PR target/41081
@ -71,8 +77,7 @@
PR target/40671
* config/rs6000/rs6000.c (rs6000_override_options): Use
TARGET_64BIT instead of TARGET_POWERPC64 to set the size of
pointers.
TARGET_64BIT instead of TARGET_POWERPC64 to set the size of pointers.
PR target/41145
* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): Fix
@ -105,8 +110,7 @@
2009-08-20 Richard Guenther <rguenther@suse.de>
* c-objc-common.h (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Do not
define.
* c-objc-common.h (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Do not define.
* c-tree.h (c_dup_lang_specific_decl): Remove.
(struct lang_decl, struct lang_type): Move definitions ...
* c-lang.h: ... here. New file.
@ -253,8 +257,7 @@
2009-08-16 Douglas B Rupp <rupp@gnat.com>
* doc/invoke.texi (Target options):
Add new option list for IA-64/VMS.
* doc/invoke.texi (Target options): Add new option list for IA-64/VMS.
(menu): Add IA-64/VMS Options.
(IA-64/VMS Options): Likewise.
@ -337,15 +340,12 @@
* doc/extend.texi (Symbol-Renaming Pragmas): redefine_extname is
supported on all platforms.
* target.h (struct gcc_target): Remove
handle_pragma_redefine_extname.
* c-cppbuiltin.c: Remove use of
targetm.handle_pragma_redefine_extname.
* target.h (struct gcc_target): Remove handle_pragma_redefine_extname.
* c-cppbuiltin.c: Remove use of targetm.handle_pragma_redefine_extname.
* c-pragma.c: Likewise.
* target-def.h (TARGET_INITIALIZER): Remove
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
* config/sol2.h: Remove use of
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
* config/sol2.h: Remove use of TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
2009-08-14 Douglas B Rupp <rupp@gnat.com>
@ -400,8 +400,8 @@
2009-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR middle-end/30789
* builtins.c (do_mpc_arg2): Make extern, define for any MPC
version. Move declaration...
* builtins.c (do_mpc_arg2): Make extern, define for any MPC version.
Move declaration...
* real.h (do_mpc_arg2): ... here.
* fold-const.c (const_binop): Use MPC for complex MULT_EXPR
and RDIV_EXPR.

View File

@ -15476,22 +15476,25 @@
(match_operand:SI 1 "" ""))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
(match_operand:SI 2 "immediate_operand" "i")))]
"!TARGET_64BIT"
"!SIBLING_CALL_P (insn) && !TARGET_64BIT"
{
if (constant_call_address_operand (operands[0], Pmode))
{
if (SIBLING_CALL_P (insn))
return "jmp\t%P0";
else
return "call\t%P0";
}
if (SIBLING_CALL_P (insn))
return "jmp\t%A0";
else
return "call\t%A0";
return "call\t%P0";
return "call\t%A0";
}
[(set_attr "type" "call")])
(define_insn "*sibcall_pop_1"
[(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
(match_operand:SI 1 "" ""))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
(match_operand:SI 2 "immediate_operand" "i,i")))]
"SIBLING_CALL_P (insn) && !TARGET_64BIT"
"@
jmp\t%P0
jmp\t%A0"
[(set_attr "type" "call")])
(define_expand "call"
[(call (match_operand:QI 0 "" "")
(match_operand 1 "" ""))

View File

@ -1,3 +1,8 @@
2009-08-23 Uros Bizjak <ubizjak@gmail.com>
PR target/40718
* gcc.target/i386/pr40718.c: New test.
2009-08-22 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/proc_ptr_24.f90: New test.
@ -22,8 +27,8 @@
2009-08-21 Uros Bizjak <ubizjak@gmail.com>
* gfortran.dg/boz_9.f90: Do not generate denormal floating
point numbers. Remove -mieee option for alpha*-*-* targets.
* gfortran.dg/boz_9.f90: Do not load denormal floating
point constants. Remove -mieee option for alpha*-*-* targets.
2009-08-21 Janus Weil <janus@gcc.gnu.org>

View File

@ -0,0 +1,36 @@
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O1 -foptimize-sibling-calls" } */
void abort (void);
struct S
{
void (__attribute__((__stdcall__)) *f) (struct S *);
int i;
};
void __attribute__((__stdcall__))
foo (struct S *s)
{
s->i++;
}
void __attribute__((__stdcall__))
bar (struct S *s)
{
foo(s);
s->f(s);
}
int main (void)
{
struct S s = { foo, 0 };
bar (&s);
if (s.i != 2)
abort ();
return 0;
}