From patchwork Tue Nov 18 00:15:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 411871 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 9EB1714009B for ; Tue, 18 Nov 2014 11:15:45 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; q=dns; s=default; b=TV3bTOwKbpW28TnQ ImrutKavzNDJ6gtMY8h8jCz2VIKmWLrSckNn2YEO1RSHjFmGfJI3gj3/b3yIPG54 PInY8Ri1odZdUeRPb6oezvs8VsZzAaxS5YrQL2yMEnvf+e+BNA31/8owEsH3HzYN onCYTJ3fY/omlQihOGh7MbIE1CI= 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 :message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; s=default; bh=D9FLyEsVosHZPR5YAmtb68 DTEe8=; b=ncvgmfzWPL2d1Pchn6sBG+FdPDFf6OTXf5G04Us+z0BFzv6SILQkkq HVCRf/5ad0vbVlRB8ZE0HXX76SDRLTcqtr2+1AgYml5mRamsXnoeLJiBDSSSN+lw o8itRZX4RTxZhJROLRCgeofLdsFjGaCOVaSIyIdp3MvQJsW/Z7fU4= Received: (qmail 28776 invoked by alias); 18 Nov 2014 00:15: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 28760 invoked by uid 89); 18 Nov 2014 00:15:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 18 Nov 2014 00:15:37 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAI0FZIk029491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 17 Nov 2014 19:15:36 -0500 Received: from VMBP.local (vpn-62-171.rdu2.redhat.com [10.10.62.171]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAI0FZdL008593 for ; Mon, 17 Nov 2014 19:15:35 -0500 Message-ID: <546A8FA7.7000208@redhat.com> Date: Mon, 17 Nov 2014 19:15:35 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR63906 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906 LRA rematerialization checks SP offsets at origin and rematerialization places when trying to rematerialize an insn. But the offsets are not valid if sp elimination is prohibited (e.g. when alloca is used). Value of frame_pointer_required is a flag of this. The patch was bootstrapped on aarch64 and committed as rev. 217683. 2014-11-17 Vladimir Makarov PR rtl-optimization/63906 * lra-remat.c (operand_to_remat): Check SP and frame_pointer_required. Index: lra-remat.c =================================================================== --- lra-remat.c (revision 217658) +++ lra-remat.c (working copy) @@ -399,7 +399,13 @@ operand_to_remat (rtx_insn *insn) /* First find a pseudo which can be rematerialized. */ for (reg = id->regs; reg != NULL; reg = reg->next) - if (reg->type == OP_OUT && ! reg->subreg_p + /* True FRAME_POINTER_NEEDED might be because we can not follow + changing sp offsets, e.g. alloca is used. If the insn contains + stack pointer in such case, we can not rematerialize it as we + can not know sp offset at a rematerialization place. */ + if (reg->regno == STACK_POINTER_REGNUM && frame_pointer_needed) + return -1; + else if (reg->type == OP_OUT && ! reg->subreg_p && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL) { /* We permits only one spilled reg. */