On Thu, 6 Feb 2014, Jakub Jelinek wrote:

> 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

I don't like special-casing BUILT_IN_SETJMP_RECEIVER - we don't
currently have a suitable exported stmt_starts_bb_p () (the existing
one is too special), but similar to is_ctrl_altering_stmt we could
add a is_ctrl_receiving_stmt that covers nonlocal labels and other
stmts we add abnormal edges to.  Btw, why isn't BUILT_IN_SETJMP_RECEIVER
ECF_RETURNS_TWICE?

Thanks,
Richard.

> 2014-02-06  Jakub Jelinek  <ja...@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.i...@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
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer

Reply via email to