From patchwork Fri Oct 3 08:35:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 396161 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C4F24140140 for ; Fri, 3 Oct 2014 18:35:45 +1000 (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:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=R2zf6HvVdSeHbll15 UVxKOtiONI2u62f524v5v2+dl5hSoBuTtjRlwdwtwPy4hgiJ7JKv3BXz6NUETjYo vPf+WwUclmi0KEmZ92OILrDds+HL2NePnoPqN9k7VmNq1Uhw5msoapMoIDOCas6M rIxwoPxBowMpcGsW6dwETobzes= 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:references:mime-version :content-type:in-reply-to; s=default; bh=1ihbmtIWw3L4r4ulqV+Iqjt gzwU=; b=CJXt6ds67Ziq/EVJrxOE+k7tu5ExrrjVXkQHaDDqvKV90rcZDqnmdfG /n+ZTotCBlYjx8pWpm0pFFHccQh+oCtEQvaUkapET/4B1G23aw8II4UIBCjGCeUI CH2G7UOCW78Wln11WMtCam7swY6W/gcs2BJvrz8YrTtH8DkWzDa0= Received: (qmail 17225 invoked by alias); 3 Oct 2014 08:35: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 17213 invoked by uid 89); 3 Oct 2014 08:35:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f171.google.com Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 03 Oct 2014 08:35:36 +0000 Received: by mail-pd0-f171.google.com with SMTP id ft15so2214828pdb.16 for ; Fri, 03 Oct 2014 01:35:34 -0700 (PDT) X-Received: by 10.70.34.9 with SMTP id v9mr376152pdi.157.1412325334851; Fri, 03 Oct 2014 01:35:34 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id pb1sm3653409pdb.74.2014.10.03.01.35.32 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Oct 2014 01:35:34 -0700 (PDT) Date: Fri, 3 Oct 2014 12:35:13 +0400 From: Ilya Enkovich To: Jeff Law Cc: gcc-patches , Vladimir Makarov Subject: Re: [PATCH] Avoid ICE in LRA for calls with multiple return values Message-ID: <20141003083513.GA50375@msticlxl57.ims.intel.com> References: <20141002143000.GH28697@msticlxl57.ims.intel.com> <542D99BC.9010005@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On 03 Oct 00:05, Ilya Enkovich wrote: > 2014-10-02 22:30 GMT+04:00 Jeff Law : > > On 10/02/14 08:30, Ilya Enkovich wrote: > >> > >> Hi, > >> > >> This patch adds a check for call destination register for a call return > >> value optimization based on REG_RETURNED note. This solves some ICE issues > >> for MPX codes. > >> > >> Bootstrapped and tested on linux-x86_64. OK for trunk? > >> > >> Thanks, > >> Ilya > >> -- > >> 2014-10-02 Ilya Enkovich > >> > >> * lra-constraints.c (inherit_in_ebb): Handle calls with > >> multiple return values. > >> * caller-save.c (save_call_clobbered_regs): Likewise. > > > > This is fine. Please put a comment before the new if (REG_P (...))) > > conditional which notes that a CALL_INSN may have multiple return values > > expressed in an EXPR_LIST. That way if someone looks at this code a few > > years down the line, they'll know exactly why the code checks REG_P rather > > than just using the result blindly. > > > > Did this fix all the multiple-return issues you encountered? > > With this fix almost all benchmarks compile successfully but there is > still one ICE in LRA. I described it in MPX ABI thread. > > Ilya > > > > > Jeff > > Here is a vestion to be committed. Ilya --- 2014-10-02 Ilya Enkovich * lra-constraints.c (inherit_in_ebb): Handle calls with multiple return values. * caller-save.c (save_call_clobbered_regs): Likewise. diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 11df2ec..e28facb 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -879,8 +879,13 @@ save_call_clobbered_regs (void) if (GET_CODE (pat) == PARALLEL) pat = XVECEXP (pat, 0, 0); dest = SET_DEST (pat); - newpat = gen_rtx_SET (VOIDmode, cheap, copy_rtx (dest)); - chain = insert_one_insn (chain, 0, -1, newpat); + /* For multiple return values dest is PARALLEL. + Currently we handle only single return value case. */ + if (REG_P (dest)) + { + newpat = gen_rtx_SET (VOIDmode, cheap, copy_rtx (dest)); + chain = insert_one_insn (chain, 0, -1, newpat); + } } } last = chain; diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 5f68399..f1642f3 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5348,16 +5348,21 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail) if (GET_CODE (pat) == PARALLEL) pat = XVECEXP (pat, 0, 0); dest = SET_DEST (pat); - start_sequence (); - emit_move_insn (cheap, copy_rtx (dest)); - restore = get_insns (); - end_sequence (); - lra_process_new_insns (curr_insn, NULL, restore, - "Inserting call parameter restore"); - /* We don't need to save/restore of the pseudo from - this call. */ - usage_insns[regno].calls_num = calls_num; - bitmap_set_bit (&check_only_regs, regno); + /* For multiple return values dest is PARALLEL. + Currently we handle only single return value case. */ + if (REG_P (dest)) + { + start_sequence (); + emit_move_insn (cheap, copy_rtx (dest)); + restore = get_insns (); + end_sequence (); + lra_process_new_insns (curr_insn, NULL, restore, + "Inserting call parameter restore"); + /* We don't need to save/restore of the pseudo from + this call. */ + usage_insns[regno].calls_num = calls_num; + bitmap_set_bit (&check_only_regs, regno); + } } } to_inherit_num = 0;