From patchwork Thu Oct 2 14:30:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 395970 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 B13AC14016B for ; Fri, 3 Oct 2014 00:30:23 +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:mime-version:content-type; q=dns; s=default; b=rf6obovlUni/e1vTWZkEoQlDhDP1Yghvc37fmOTX60DxKOJ0gP hMp6DkUSAjwLOHq/4y7KiEB3wdgc7VBXcCDUEGs9aWhGRQH5IS7xSRmvkhjNlxQa tWE0h4bp50dKoAT/q4iYP8xwFT+CFyUG5IF53iJtSvXwLj8w5jUGgfsUE= 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=9vMZj5D+7LaPhXdKNNjeXLHM8+8=; b=p+lfx9lKgm4n4JiySUNx 7TIqxQlcIiyawtpthQNRD1S6ri4xnmYFef/UhK4ZDZQfQ/HneGdoenOywFRdiYhx FdS/vsHCYS0Pqw9fxdBWhUEOcH6DtRjjy3zQ9BwmLKtAFcycvow7vnEOd26YQ1KW ELybKKBp3Uokr7Pc8yFRHgg= Received: (qmail 29681 invoked by alias); 2 Oct 2014 14:30:12 -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 29595 invoked by uid 89); 2 Oct 2014 14:30:11 -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-pa0-f42.google.com Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 02 Oct 2014 14:30:10 +0000 Received: by mail-pa0-f42.google.com with SMTP id bj1so2561782pad.1 for ; Thu, 02 Oct 2014 07:30:09 -0700 (PDT) X-Received: by 10.66.65.133 with SMTP id x5mr85535451pas.26.1412260208829; Thu, 02 Oct 2014 07:30:08 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id hu4sm3747829pbb.68.2014.10.02.07.30.06 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Oct 2014 07:30:08 -0700 (PDT) Date: Thu, 2 Oct 2014 18:30:00 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Cc: Vladimir Makarov , Jeff Law Subject: [PATCH] Avoid ICE in LRA for calls with multiple return values Message-ID: <20141002143000.GH28697@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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. diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 11df2ec..f983165 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -879,8 +879,11 @@ 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); + 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..cd54abd 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5348,16 +5348,19 @@ 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); + 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;