From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 515 invoked by alias); 11 Nov 2008 18:10:50 -0000 Received: (qmail 32225 invoked by uid 22791); 11 Nov 2008 18:10:44 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Nov 2008 18:10:07 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mABIA6He011910 for ; Tue, 11 Nov 2008 13:10:06 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mABIA5n2024431 for ; Tue, 11 Nov 2008 13:10:05 -0500 Received: from stone.twiddle.home (vpn-51-19.sfbay.redhat.com [10.14.51.19]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mABIA32k012713 for ; Tue, 11 Nov 2008 13:10:03 -0500 Message-ID: <4919CA7A.2010004@redhat.com> Date: Tue, 11 Nov 2008 18:27:00 -0000 From: Richard Henderson User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [trans-mem] rewrite ipa pass Content-Type: multipart/mixed; boundary="------------090900000702040504080009" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-11/txt/msg00461.txt.bz2 This is a multi-part message in MIME format. --------------090900000702040504080009 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 727 The previous incarnation of the IPA pass failed on the second test case I tried -- a call to an external tm_callable function. As I got looking into fixing this, I realized that I wasn't actually iterating into the transactional clones, and so wasn't generating all of the clones that are needed. The following rewrite handles both of these problems, as well as integrating detection of regions that contain irrevokable operations. Once we see an irrevokable operation, there's no point in instrumenting anything further within the transaction, which means there's no point in calling a transactional clone from within an irrevokable region, which is how this ties into the IPA pass that generates these clones. r~ --------------090900000702040504080009 Content-Type: text/plain; name="z.txt" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="z.txt" Content-length: 69862 CSogY2dyYXBoLmggKHN0cnVjdCBjZ3JhcGhfZWRnZSk6IFJlbW92ZSB0bV9h dG9taWNfY2FsbC4KCShjZ3JhcGhfY29weV9ub2RlX2Zvcl92ZXJzaW9uaW5n KTogRGVjbGFyZS4KCSogY2dyYXBodW5pdC5jIChjZ3JhcGhfY29weV9ub2Rl X2Zvcl92ZXJzaW9uaW5nKTogRXhwb3J0OwoJY29weSBhbmFseXplZCBmcm9t IG9sZCB2ZXJzaW9uLgoJKGNncmFwaF9mdW5jdGlvbl92ZXJzaW9uaW5nKTog RG8gREVDTF9OQU1FIGV0IGFsIHNldHVwIGhlcmUgLi4uCgkqIHRyZWUtaW5s aW5lLmMgKHRyZWVfZnVuY3Rpb25fdmVyc2lvbmluZyk6IC4uLiBub3QgaGVy ZS4KCSogaXBhLWlubGluZS5jIChjZ3JhcGhfZ2F0ZV9lYXJseV9pbmxpbmlu Zyk6IERvbid0IGNoZWNrIFRNX0NMT05FLgoJKiBwYXNzZXMuYyAoaW5pdF9v cHRpbWl6YXRpb25fcGFzc2VzKTogRG8gaXBhX3RtIGJlZm9yZSBpcGFfY3Au CgkqIHRyYW5zLW1lbS5jIChpc190bV9wdXJlX2NhbGwpOiBOZXcuCgkoaXNf dG1fZW5kaW5nX2ZuZGVjbCwgZmluZF90bV9yZXBsYWNlbWVudF9mdW5jdGlv bik6IE5ldy4KCShleGFtaW5lX2NhbGxfdG0pOiBEb24ndCBsb29rIGZvciBp cnJldm9rYWJsZSBjYWxscyBoZXJlLgoJKGV4ZWN1dGVfbG93ZXJfdG0pOiBB c3NlcnQgd2UgZG9uJ3Qgc2VlIFRNX0NMT05Fcy4K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XBfZGVjbF9uYW1lIChidWZmZXIsIG5v ZGUsIDApOwogfQo= --------------090900000702040504080009--