This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix up __builtin_setjmp_receiver handling (PR c++/60082)


Hi!

I've looked at the spawner_inline.c timeout issue, and it looks like the
problem is that __builtin_setjmp_receiver is a stmt_ends_bb_p call and
insert_backedge_copies then happily inserts statements before the call,
because it can't insert them after the call.  But __builtin_setjmp_receiver
is quite special beast, it's bb is reachable only through an abnormal edge
and it pretty much relies on being at the beginning of the bb, as before the
call e.g. frame pointer value is bogus, the expansion of the call itself
fixes that up and then emits a blockage to make sure things aren't
reordered.  But when outof-ssa emits something before the builtin, it isn't
reordered, but is on the wrong side of the frame pointer restoration.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?  Alternatively we could special case BUILT_IN_SETJMP_RECEIVER instead
in call_can_make_abnormal_goto, there is probably no need to have AB edge
out of __builtin_setjmp_receiver, we already have one out of
__builtin_setjmp_setup and receiver is really expanded just to load of frame
pointer, so it doesn't jump anywhere.

Note that this fixes both the CK tests on x86_64-linux, on i686-linux
neither of them timeout, but catch_exc.cc still fails:
 FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O1 -fcilkplus execution test
 FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O3 -fcilkplus execution test
 FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -O2 -fcilkplus execution test

2014-02-06  Jakub Jelinek  <jakub@redhat.com>

	PR c++/60082
	* tree-outof-ssa.c (insert_backedge_copies): Never insert statements
	before __builtin_setjmp_receiver.

	Revert
	2014-02-05  Balaji V. Iyer  <balaji.v.iyer@intel.com>

	* g++.dg/cilk-plus/CK/catch_exc.cc: Disable test for -O1.
	* c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise.

--- gcc/tree-outof-ssa.c.jj	2014-01-03 11:41:01.000000000 +0100
+++ gcc/tree-outof-ssa.c	2014-02-05 22:12:03.637412102 +0100
@@ -1152,6 +1152,12 @@ insert_backedge_copies (void)
 		      if (TREE_CODE (arg) == SSA_NAME
 			  && SSA_NAME_DEF_STMT (arg) == last)
 			continue;
+		      /* Never insert anything before
+			 __builtin_setjmp_receiver, that builtin should be
+			 immediately after labels.  */
+		      if (gimple_call_builtin_p (last,
+						 BUILT_IN_SETJMP_RECEIVER))
+			continue;
 		    }
 
 		  /* Create a new instance of the underlying variable of the
--- gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc	(revision 207519)
+++ gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc	(revision 207518)
@@ -1,7 +1,6 @@
 /* { dg-options "-fcilkplus" } */
 /* { dg-do run { target i?86-*-* x86_64-*-* arm*-*-* } } */
 /* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* arm*-*-* } } } */
-/* { dg-skip-if "" { *-*-* } { "-O1" } { "" } } */
 
 #include <assert.h>
 #include <unistd.h>
--- gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c	(revision 207519)
+++ gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c	(revision 207518)
@@ -1,7 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus" } */
 /* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
-/* { dg-skip-if "" { *-*-* } { "-O1" } { "" } } */
 
 #include <stdlib.h>
 #define DEFAULT_VALUE 30

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]