From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13782 invoked by alias); 23 Jul 2009 17:28:41 -0000 Received: (qmail 13756 invoked by uid 22791); 23 Jul 2009 17:28:39 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from atrey.karlin.mff.cuni.cz (HELO atrey.karlin.mff.cuni.cz) (195.113.26.193) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Jul 2009 17:28:31 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id 9B60FF0066; Thu, 23 Jul 2009 19:28:28 +0200 (CEST) Date: Thu, 23 Jul 2009 17:28:00 -0000 From: Jan Hubicka To: Richard Henderson Cc: jh@suse.cz, gcc@gcc.gnu.org Subject: Re: [trans-mem] cgraph edges vs function cloning Message-ID: <20090723172828.GA20017@atrey.karlin.mff.cuni.cz> References: <4A67BF29.9090208@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A67BF29.9090208@twiddle.net> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00441.txt.bz2 > Could I convince you to have a look at the transactional-memory branch > test libitm/testsuite/libitm.c++/eh-1.C? I'm getting > > z.c:36:1: error: edge void f1()->void* __cxa_allocate_exception(long > unsigned int) has no corresponding call_stmt > D.2114_4 = __cxa_allocate_exception (4); > > z.c:36:1: error: edge void f1()->void __cxa_throw(void*, void*, void > (*)(void*)) has no corresponding call_stmt > __cxa_throw (D.2114_4, &_ZTIi, 0B); > > void f1()/10(-1) @0x7ffff2d75500 availability:available 32 time, 10 > benefit 14 size, 1 benefit reachable body finalized > called by: void f2()/1 (1.00 per call) (can throw external) > calls: void _ITM_cxa_throw(void*, void*, void (*)(void*))/12 (1.00 > per call) (can throw external) void* _ITM_cxa_allocate_exception(long > unsigned int)/11 (1.00 per call) void* __cxa_allocate_exception(long > unsigned int)/8 (1.00 per call) void __cxa_throw(void*, void*, void > (*)(void*))/9 (1.00 per call) (can throw external) > z.c:36:1: internal compiler error: verify_cgraph_node failed > > This happens because cgraph_copy_node_for_versioning duplicated all of > the callee edges from the original function, and > tree_function_versioning created new edges when copying the body of the > function instead of updating the edges we duplicated. > > Frankly, the unholy mess of edge update options has me stumped. I have > no idea what's going on in this area. Why bother with any of it anyway? > Why not just always create all new callee edges when instantiating the > new body? Well, while doing main IPA passes, we need to preserve information attached to edges, so we want to copy them and not create all of them from scratch. So the basic idea is to duplicate all the edges with old statement and when new statements are created, tree_function_versioning should update the call_stmt and create new edges only when new call really appears (it is possible when we do constant propagation or such). When you are not copying the whole function body, you will need to remove those edges that are outside region being duplicated, perhaps that is the problem? I will try to look into this. Honza > > > r~