From patchwork Wed Apr 4 13:14:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 150729 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 D4313B6FE8 for ; Wed, 4 Apr 2012 23:14:26 +1000 (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=1334150068; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To: User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=kxuTRRa l26pYjWk1uLVsDXW+7m8=; b=Cr1EQ+pjMlS+V7vT2dO+70DAvPC4Qj8G3SF7eqg +SuszOiWA6iErz+997NTcyJa/Vkn1pbMf80hnLeZHsJwMoah3iY7318WOSY3ff9f NR5DoTGnT5blqMyszpMBtKjKYFo0ZwSF2A0I/PS+Hzn1tiUEna5Q5V4wBLsDp/ik ySsM= 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:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=jMgOpz5Jx8Yiwe07kDjap1Bb+e70SE0wiNWmjxIMn9cEBii4KmQ02h5H0MQvdQ q5rDxDeOyg7UHyXVDWz8gMCX8KKzSj5N/nkIQc4zossHMFzsYjr0OOpHHyBU02Tt HOj9Yvc6IX+0Tkq2Cpx16botbfWWUTYTJAuO2h1MNy3Bs=; Received: (qmail 22231 invoked by alias); 4 Apr 2012 13:14:19 -0000 Received: (qmail 22185 invoked by uid 22791); 4 Apr 2012 13:14:17 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI 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; Wed, 04 Apr 2012 13:14:03 +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 5526B94A8C; Wed, 4 Apr 2012 15:14:02 +0200 (CEST) Date: Wed, 4 Apr 2012 15:14:01 +0200 From: Martin Jambor To: Eric Botcazou Cc: Richard Guenther , GCC Patches Subject: Re: [PATCH] Dissociate store_expr's temp from exp so that it is not marked as addressable Message-ID: <20120404131401.GA19344@virgil.arch.suse.de> Mail-Followup-To: Eric Botcazou , Richard Guenther , GCC Patches References: <20120329232205.GB2817@virgil.arch.suse.de> <201204031001.50984.ebotcazou@adacore.com> <201204031102.12177.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201204031102.12177.ebotcazou@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi, On Tue, Apr 03, 2012 at 11:02:11AM +0200, Eric Botcazou wrote: > > Yeah, that sounds reasonable. > > There is a further subtlety in the second temp allocation when the expression > doesn't use the alias set of its type. In that case, we cannot pass the type > to set_mem_attributes. In fact, since assign_stack_temp_for_type already > calls the appropriate set_mem_* routines, the best thing to do might be to > remove the call to set_mem_attributes altogether in that case. > So, something like this? Bootstrapped and tested on x86_64-linux and ia64-linux, I'm currently having problems bootsrapping sparc64 which is what I need this mainly for but those are unelated and this should help. Thanks, Martin 2012-04-03 Martin Jambor * expr.c (expand_expr_real_1): Pass type, not the expression, to set_mem_attributes for a memory temporary. Do not call the function for temporaries with a different alias set. Index: src/gcc/expr.c =================================================================== --- src.orig/gcc/expr.c +++ src/gcc/expr.c @@ -9572,6 +9572,7 @@ expand_expr_real_1 (tree exp, rtx target tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset, &mode1, &unsignedp, &volatilep, true); rtx orig_op0, memloc; + bool mem_attrs_from_type = false; /* If we got back the original object, something is wrong. Perhaps we are evaluating an expression too early. In any event, don't @@ -9677,6 +9678,7 @@ expand_expr_real_1 (tree exp, rtx target memloc = assign_temp (nt, 1, 1, 1); emit_move_insn (memloc, op0); op0 = memloc; + mem_attrs_from_type = true; } if (offset) @@ -9849,7 +9851,6 @@ expand_expr_real_1 (tree exp, rtx target emit_move_insn (new_rtx, op0); op0 = copy_rtx (new_rtx); PUT_MODE (op0, BLKmode); - set_mem_attributes (op0, exp, 1); } return op0; @@ -9870,7 +9871,14 @@ expand_expr_real_1 (tree exp, rtx target if (op0 == orig_op0) op0 = copy_rtx (op0); - set_mem_attributes (op0, exp, 0); + /* If op0 is a temporary because of forcing to memory, pass only the + type to set_mem_attributes so that the original expression is never + marked as ADDRESSABLE through MEM_EXPR of the temporary. */ + if (mem_attrs_from_type) + set_mem_attributes (op0, TREE_TYPE (exp), 0); + else + set_mem_attributes (op0, exp, 0); + if (REG_P (XEXP (op0, 0))) mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0));