From patchwork Thu Dec 7 17:52:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 845728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-468696-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="lCtCH1W6"; dkim-atps=neutral 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 3yt33d2wngz9s7B for ; Fri, 8 Dec 2017 04:52:43 +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:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=K8xlJ67TtsJv7R3u/Ar5e3kJOCsTJouOD8I1IDz6/L37ssDBtD 24CnbACfxEuuPExypJNZ4PlpEPiuTUwD/Zhp/slc8TnL7sk3KYisyPyHa8nBb9r0 SJ8hfWGgJDFuJkLukHczpEnXplspDZUCIc4oBhU7NlKis7B6ZcxbVt9tc= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=gNeHX6LMV40bARkLByaTuf2SAJU=; b=lCtCH1W66sw/ZKp9mxrr V8Ss2XRQeZimWLNDeVRApJppjuVennYp8y7kY+HZofNZ5F53ZsFkRLeQ6ecrY4GW 36JwphQG1hSoztEW1xpRDY4goifuE9r1ZGBySbUdVfZH3zOSiJG2H79RLostkN/u RYs/vP6gyltalF0UqZzCGrs= Received: (qmail 43234 invoked by alias); 7 Dec 2017 17:52:33 -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 42963 invoked by uid 89); 7 Dec 2017 17:52:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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 ESMTP; Thu, 07 Dec 2017 17:52:31 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19AF72D2688 for ; Thu, 7 Dec 2017 17:52:30 +0000 (UTC) Received: from [10.10.121.10] (ovpn-121-10.rdu2.redhat.com [10.10.121.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B2A370134; Thu, 7 Dec 2017 17:52:28 +0000 (UTC) From: Vladimir Makarov Subject: patch to fix PR83252 and PR80818 To: "gcc-patches@gcc.gnu.org" Cc: Jakub Jelinek Message-ID: <46e0039b-2cfc-a71a-f795-56364e280794@redhat.com> Date: Thu, 7 Dec 2017 12:52:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes PR83252 and PR80818. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83252 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 The patch was successfully tested and bootstrapped on ppc64 and x86_64. Committed as rev. 255471. Jakub, the patch does not include a test case for PR83252.  Could you add your test to the trunk. Index: ChangeLog =================================================================== --- ChangeLog (revision 255470) +++ ChangeLog (working copy) @@ -1,3 +1,12 @@ +2017-12-07 Vladimir Makarov + + PR target/83252 + PR rtl-optimization/80818 + * lra.c (add_regs_to_insn_regno_info): Make a hard reg in CLOBBER + always early clobbered. + * lra-lives.c (process_bb_lives): Check input hard regs for early + clobbered non-operand hard reg. + 2017-12-07 Jakub Jelinek PR middle-end/83164 Index: lra.c =================================================================== --- lra.c (revision 255470) +++ lra.c (working copy) @@ -1476,15 +1476,11 @@ add_regs_to_insn_regno_info (lra_insn_re add_regs_to_insn_regno_info (data, SET_SRC (x), insn, OP_IN, false, 0); break; case CLOBBER: - { - int code = INSN_CODE (insn); - - /* We treat clobber of non-operand hard registers as early - clobber (the behavior is expected from asm). */ - add_regs_to_insn_regno_info (data, XEXP (x, 0), insn, OP_OUT, - code < 0, code < 0 ? ALL_ALTERNATIVES : 0); - break; - } + /* We treat clobber of non-operand hard registers as early + clobber. */ + add_regs_to_insn_regno_info (data, XEXP (x, 0), insn, OP_OUT, + true, ALL_ALTERNATIVES); + break; case PRE_INC: case PRE_DEC: case POST_INC: case POST_DEC: add_regs_to_insn_regno_info (data, XEXP (x, 0), insn, OP_INOUT, false, 0); break; Index: lra-lives.c =================================================================== --- lra-lives.c (revision 255470) +++ lra-lives.c (working copy) @@ -928,7 +928,18 @@ process_bb_lives (basic_block bb, int &c for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) if (reg->type == OP_OUT && reg_early_clobber_p (reg, n_alt) && ! reg->subreg_p) - make_hard_regno_dead (reg->regno); + { + struct lra_insn_reg *reg2; + + /* We can have early clobbered non-operand hard reg and + the same hard reg as an insn input. Don't make hard + reg dead before the insns. */ + for (reg2 = curr_id->regs; reg2 != NULL; reg2 = reg2->next) + if (reg2->type != OP_OUT && reg2->regno == reg->regno) + break; + if (reg2 == NULL) + make_hard_regno_dead (reg->regno); + } if (need_curr_point_incr) next_program_point (curr_point, freq);