From patchwork Wed Oct 18 16:52:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 827747 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-464460-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="bRsVwat6"; 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 3yHJ5k3ns5z9t5s for ; Thu, 19 Oct 2017 03:52:56 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=LcIwMJD1e2KOw9AMhf4DuSlUhdGFx3d8oKAhnAzt/02OR8fH13 53jgUHiGkDNqa7/APZ9mxibPvRVCptQHTLkADH9uBH5Y3T+cS6jaRvnFPV0GZSO8 DUZkDNZ324alnehDTPOVu9wVpWOo4nZZ4nOUkWzXJTd5qhGkAmUFlwimw= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=ZjDM2nSsmQUBfJWxcJxK74Nndbg=; b=bRsVwat6PFvivkBubftW KIiq6TKOx/os82nvPnaCNKz52y+vTg5mLqG5eaM9jexzi5L85QCDTDPM9siQV1fA cJOYydRBD+hv/kfqFMSR2WYKHzQXYRsRUuvAyUjFl5cOy4l1HYUc+kNKDKvzuaL5 9BL48id8Umqul7rvgSDX5Hc= Received: (qmail 74677 invoked by alias); 18 Oct 2017 16:52:48 -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 74661 invoked by uid 89); 18 Oct 2017 16:52:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fwrapv 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; Wed, 18 Oct 2017 16:52:46 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AED81E328 for ; Wed, 18 Oct 2017 16:52:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4AED81E328 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=vmakarov@redhat.com Received: from [10.10.120.8] (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED58E9A249 for ; Wed, 18 Oct 2017 16:52:44 +0000 (UTC) To: "gcc-patches@gcc.gnu.org" From: Vladimir Makarov Subject: patch to fix PR82556 Message-ID: <9e474fd3-50c6-1a3f-b453-0867afe61ea1@redhat.com> Date: Wed, 18 Oct 2017 12:52:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82556 The patch was bootstrapped and tested on x86-64. Committed to trunk as rev. 253862. Committed to gcc-7-branch as rev. 253863. Index: ChangeLog =================================================================== --- ChangeLog (revision 253862) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2017-10-18 Vladimir Makarov + + PR middle-end/82556 + * lra-constraints.c (curr_insn_transform): Use non-input operand + instead of output one for matched reload. + 2017-10-17 Jakub Jelinek PR tree-optimization/82549 Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 253862) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2017-10-18 Vladimir Makarov + + PR middle-end/82556 + * gcc.target/i386/pr82556.c: New. + 2017-10-17 Eric Botcazou * gcc.dg/attr-alloc_size-11.c: UnXFAIL for visium-*-*. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 253815) +++ lra-constraints.c (working copy) @@ -4284,7 +4284,13 @@ curr_insn_transform (bool check_only_p) } else if (curr_static_id->operand[i].type == OP_IN && (curr_static_id->operand[goal_alt_matched[i][0]].type - == OP_OUT)) + == OP_OUT + || (curr_static_id->operand[goal_alt_matched[i][0]].type + == OP_INOUT + && (operands_match_p + (*curr_id->operand_loc[i], + *curr_id->operand_loc[goal_alt_matched[i][0]], + -1))))) { /* generate reloads for input and matched outputs. */ match_inputs[0] = i; @@ -4295,9 +4301,14 @@ curr_insn_transform (bool check_only_p) [goal_alt_number * n_operands + goal_alt_matched[i][0]] .earlyclobber); } - else if (curr_static_id->operand[i].type == OP_OUT + else if ((curr_static_id->operand[i].type == OP_OUT + || (curr_static_id->operand[i].type == OP_INOUT + && (operands_match_p + (*curr_id->operand_loc[i], + *curr_id->operand_loc[goal_alt_matched[i][0]], + -1)))) && (curr_static_id->operand[goal_alt_matched[i][0]].type - == OP_IN)) + == OP_IN)) /* Generate reloads for output and matched inputs. */ match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before, &after, curr_static_id->operand_alternative Index: testsuite/gcc.target/i386/pr82556.c =================================================================== --- testsuite/gcc.target/i386/pr82556.c (nonexistent) +++ testsuite/gcc.target/i386/pr82556.c (working copy) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fwrapv -fexcess-precision=standard" } */ +extern int foo(); +typedef struct { + char id; + unsigned char fork_flags; + short data_length; +} Header; +int a; +void X() { + do { + char* b; + Header c; + if (a) + c.fork_flags |= 1; + __builtin_memcpy(b, &c, __builtin_offsetof(Header, data_length)); + b += foo(); + } while (1); +}