From patchwork Thu Feb 6 07:37:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 317381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CA83A2C009A for ; Thu, 6 Feb 2014 18:37:51 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=ohuSjKFXKARMHk6rKwvAoKemGbFn2 LDoeVEnrz6qMYBf7E8P/vx0aPxM/1YJipnd0dEygQ44bQ/c3vkChYgZ1uLWq7RQ0 //lqWAvjB/pichPKmXuQjRdyFTSumcJswUMYvK23O96VqxVqGFk5FYyUCHOzIDM7 4jQpNOSs+24RlI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=eoetdAgJxxHNe4zK45bASB3qpfk=; b=vrp 5PNbRym0VQPh9WCi+nN0DIZ46R4Lvu/74u34pHkYYR0j8sXeI+xzAOXeAZgfyRZ/ jOwnLMWSRD1Toh6E6vFUJonGNAhV7Lli8K8CxUjHQRHQjYS0WUmpxZ81R7x0uUO6 t+yinu6Ibe4wrvupxqzHd8Sbzsf8w4GzcC9AQLPg= Received: (qmail 23430 invoked by alias); 6 Feb 2014 07:37:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 23416 invoked by uid 89); 6 Feb 2014 07:37:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2014 07:37:39 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s167bZj6009688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Feb 2014 02:37:36 -0500 Received: from tucnak.zalov.cz (vpn1-6-146.ams2.redhat.com [10.36.6.146]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s167bX3q028762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Feb 2014 02:37:34 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id s167bXtU031968; Thu, 6 Feb 2014 08:37:33 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id s167bWk2031967; Thu, 6 Feb 2014 08:37:32 +0100 Date: Thu, 6 Feb 2014 08:37:32 +0100 From: Jakub Jelinek To: Richard Biener , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix up __builtin_setjmp_receiver handling (PR c++/60082) Message-ID: <20140206073732.GQ12671@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 PR c++/60082 * tree-outof-ssa.c (insert_backedge_copies): Never insert statements before __builtin_setjmp_receiver. Revert 2014-02-05 Balaji V. Iyer * g++.dg/cilk-plus/CK/catch_exc.cc: Disable test for -O1. * c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise. Jakub --- 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 #include --- 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 #define DEFAULT_VALUE 30