From patchwork Tue Dec 3 16:53:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 296249 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 205B02C00A4 for ; Wed, 4 Dec 2013 03:55:09 +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:mime-version:content-type; q=dns; s=default; b=MnUCC+hnTVH8jTjZ5E3qPqzYuPp3jAzRsONMCSLVHq/K0bJSQn II+ln267v5Iv39ibULgegLuRbKHIs4RrsjYObfM0QpY97/h4KYgsd/oH+kghiuwi 7j5vS8CfXLOyZlHmDQKEpWm/Ev5NPe1rvZYTibyDnHIbSazeG1B2yWdHU= 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:mime-version:content-type; s= default; bh=/ki3fM4Nq+DN02ifpE3Nqymy9RU=; b=gnzJTW0EqTy8lucKmQ6t Jx4evlhbJLI35AAH5sAVparc7WUz0FH4Q4k61x9sLeAnHkGwoqqcdfURoSFQzToh xTErhP5eSUoTwunkEJ/r0qAHvm8khbvLr/dUIOP1KdO0o4xrZ0oSm813PHn2sqR8 5O4ykVEAzvf7z7m6jo10pn4= Received: (qmail 9475 invoked by alias); 3 Dec 2013 16:54:39 -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 9449 invoked by uid 89); 3 Dec 2013 16:54:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_50, RDNS_NONE autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from Unknown (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Dec 2013 16:53:12 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EBCDDA7B7E for ; Tue, 3 Dec 2013 17:53:03 +0100 (CET) Date: Tue, 3 Dec 2013 17:53:03 +0100 From: Martin Jambor To: GCC Patches Cc: Richard Biener Subject: [PATCH, PR 58253] Make IPA-SRA created PARM_DECLs always naturally aligned Message-ID: <20131203165303.GB10613@virgil.suse> Mail-Followup-To: GCC Patches , Richard Biener MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, the patch below fixes a failure on the epiphany target where callers and callees do not agree on registers for parameter passing because they see different alignment of actual arguments and formal parameters (there is some more information on this in bugzilla). The actual arguments are SSA names - created by force_gimple_operand_gsi in ipa_modify_call_arguments - which are of a naturally aligned type while formal parameters are PARM_DECLs - directly built in ipa_modify_formal_parameters - of the types specified in ipa_parm_adjustment_vec which may not be aligned. Because we use the alignment of types in ipa_parm_adjustment_vec to signal to ipa_modify_call_arguments that it needs to built unaligned MEM_REFs, it is ipa_modify_formal_parameters that has to fix up the PARM_DECLs in cases where callers will produce SSA_NAMES, i.e. when the type is a gimple_register_type. That's what the patch below does. Bootstrapped and tested on x86_64-linux, only a slightly different patch also passed bootstrap on ppc64-linux and has been confirmed to fix the problem on epiphany. OK for trunk? Thanks, Martin 2013-11-28 Martin Jambor PR ipa/58253 * ipa-prop.c (ipa_modify_formal_parameters): Create decls of non-BLKmode in their naturally aligned type. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 712dab7..83dc53e 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3444,7 +3444,15 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments) if (adj->by_ref) ptype = build_pointer_type (adj->type); else - ptype = adj->type; + { + ptype = adj->type; + if (is_gimple_reg_type (ptype)) + { + unsigned malign = GET_MODE_ALIGNMENT (TYPE_MODE (ptype)); + if (TYPE_ALIGN (ptype) < malign) + ptype = build_aligned_type (ptype, malign); + } + } if (care_for_types) new_arg_types = tree_cons (NULL_TREE, ptype, new_arg_types);