From patchwork Fri Jan 27 09:35:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 138202 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]) by ozlabs.org (Postfix) with SMTP id 061CC1007D2 for ; Fri, 27 Jan 2012 20:35:42 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328261743; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=foegBBpj1AEcjzhPfNnYFWI6XD8=; b=hHcpCPACsbdf1Us H5bqYfK56LqnmyijoZ49q/6YRaW32hFfkEKcBYrgcEkvZiEvBsRpidA/GjzoHBz1 Ldy/DCKTrel75jQ9NAHqcs7tip6+qbwucvJGJjgAFZjpWQEOA/HL8zdMF1s0CPG7 HtlTaJgChHjlXgklN0KrfjjhBAC4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=TBJbs3V3ld0Hl3HhaCmsaNXYIEOU7YblBpV1gaz9OHg7Ji2evZi0KiY3e6RVn+ U5ENmB7av3YAD4W/3ONLcQxd5fFUg9ORXgcSaFZXgrqq9Bz8Wdh60y9WjjquYWlH Lvxo2ouosOmTKmYqNvEIL4HWu9CIMHq2wwh9X+8QhibxY=; Received: (qmail 4117 invoked by alias); 27 Jan 2012 09:35:33 -0000 Received: (qmail 3964 invoked by uid 22791); 27 Jan 2012 09:35:31 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Jan 2012 09:35:17 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 775008C061; Fri, 27 Jan 2012 10:35:15 +0100 (CET) Date: Fri, 27 Jan 2012 10:35:15 +0100 (CET) From: Richard Guenther To: Eric Botcazou Cc: Jakub Jelinek , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix expansion of BLKmode MEM_REF with non-addressable non-BLKmode base decl (PR middle-end/51895) In-Reply-To: Message-ID: References: <20120123181259.GK18768@tyan-ft48-01.lab.bos.redhat.com> <201201261512.14620.ebotcazou@adacore.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 On Thu, 26 Jan 2012, Richard Guenther wrote: > On Thu, 26 Jan 2012, Eric Botcazou wrote: > > > > Of course get_inner_reference looks through these kind of > > > conversions when returning the ultimate decl in MEM [&foo], > > > see the jumps in tree-ssa-alias.c we perform to re-discover > > > the view-converting cases ... (at some point I realized that > > > this probably wasn't the best design decision). So maybe > > > if the passed type isn't used in any other way we can > > > get around and discover the view-convert and use the alias-type > > > of the MEM_REF ... > > > > But I presume that the regular MEM_REF expander can cope with this case? > > Sure. > > Btw, we seem to use the TYPE argument solely for the purpose of > the assign_temp call - and in the forwarding to store_field > we pass down the very same alias_set which isn't needed, > we can just use MEM_ALIAS_SET (blk_object) here it seems, > it's different memory after all, no need to conflict with TARGET > (or set MEM_KEEP_ALIAS_SET_P - what's that ..., ah, DECL_NONADDRESSABLE > ...). > > Of course if you can simplify the code by using the regular > expander all the better (and eliminate the TYPE argument?). > > @@ -6299,7 +6302,7 @@ store_field (rtx target, HOST_WIDE_INT b > > store_field (blk_object, bitsize, bitpos, > bitregion_start, bitregion_end, > - mode, exp, type, alias_set, nontemporal); > + mode, exp, type, MEM_ALIAS_SET (blk_object), > nontemporal); > > emit_move_insn (target, object); > > > works for me. So I am testing the following - please tell me whether you are working on a different fix. Thanks, Richard. 2012-01-27 Richard Guenther PR middle-end/51959 * expr.c (store_field): Use the alias-set of the scratch memory for storing to it. * g++.dg/torture/pr51959.C: New testcase. Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 183606) +++ gcc/expr.c (working copy) @@ -6299,7 +6302,7 @@ store_field (rtx target, HOST_WIDE_INT b store_field (blk_object, bitsize, bitpos, bitregion_start, bitregion_end, - mode, exp, type, alias_set, nontemporal); + mode, exp, type, MEM_ALIAS_SET (blk_object), nontemporal); emit_move_insn (target, object); Index: gcc/testsuite/g++.dg/torture/pr51959.C =================================================================== --- gcc/testsuite/g++.dg/torture/pr51959.C (revision 0) +++ gcc/testsuite/g++.dg/torture/pr51959.C (revision 0) @@ -0,0 +1,80 @@ +// { dg-do compile } + +namespace std { + typedef __SIZE_TYPE__ size_t; +} +inline void* operator new(std::size_t, void* __p) throw() { + return __p; +} +template class QTypeInfo { +}; +enum { Q_COMPLEX_TYPE = 0, Q_PRIMITIVE_TYPE = 0x1, Q_STATIC_TYPE = 0, Q_MOVABLE_TYPE = 0x2, Q_DUMMY_TYPE = 0x4 }; +template class QFlags { + int i; + inline QFlags(Enum f) : i(f) { } +}; +class __attribute__((visibility("default"))) QSize { +public: + bool isEmpty() const; + friend inline bool operator==(const QSize &, const QSize &); + int wd; + int ht; +}; +template<> class QTypeInfo { +public: + enum { + isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; +}; +class __attribute__((visibility("default"))) QBasicAtomicInt { +public: + inline bool operator!=(int value) const { } +}; +struct __attribute__((visibility("default"))) QListData { + struct Data { + QBasicAtomicInt ref; + }; + void **append(); +}; +template class QList { + struct Node { + void *v; + }; + union { + QListData p; + QListData::Data *d; + }; +public: + void append(const T &t); + inline void push_back(const T &t) { + append(t); + } + void node_construct(Node *n, const T &t); + void node_destruct(Node *n); +}; +template inline void QList::node_construct(Node *n, const T &t) { + if (QTypeInfo::isLarge || QTypeInfo::isStatic) n->v = new T(t); + else if (QTypeInfo::isComplex) new (n) T(t); +} +template inline void QList::node_destruct(Node *n) { +} +template void QList::append(const T &t) { + if (d->ref != 1) { + try { + } + catch (...) { + } + if (QTypeInfo::isLarge || QTypeInfo::isStatic) { + } + else { + Node *n, copy; + node_construct(©, t); + try { n = reinterpret_cast(p.append());; } + catch (...) { node_destruct(©); throw; } + *n = copy; + } + } +}; +void virtual_hook(QSize sz, QList &arg) +{ + arg.push_back(sz); +}