From patchwork Fri Aug 9 16:15:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 170954 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp10215477ile; Fri, 9 Aug 2019 09:16:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyKf/1u9bGqeQokuT4nLXpOJW0xAsdB4VtK2YIMUlj+qHapVQqRvcoGp//wNP2sCDCeQxB X-Received: by 2002:a17:90a:17ab:: with SMTP id q40mr10329617pja.106.1565367369186; Fri, 09 Aug 2019 09:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565367369; cv=none; d=google.com; s=arc-20160816; b=LupIWiDfgT+uqISOkT1s1G91+h/SAeDSstml3LxAO75hECtRCiPgKw6bYBS+NjQnhC 6e6SZNSjf6J2PTVXax3PDIL97cqELa9ikxd34q7W14RdgjHhAtAXUkd9HQuX8Yg3TNUL /iMMFV2Qt24bYTuZDx7oRIje5UFuhueZ8qux9PR/SNYVINZTUBj7OPyo7dPAehuRn/Jt YSSYmJEZb7NeLwFOmr6WwO/xG2/n2mAwrlcimtzbGw+buiQAhJVUszIDnLjsc5QgIeEb NhcEAI6shQuQ/tmk8W99jnkbhOzUdcjfXHcGOlkjmQQHRUypTXAmwj2hybpx4uEGFyTW 1YhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:date:message-id:subject:from:to :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=7yyi+CFwB4nEaPMnSW+Qd7AnQwAZ5DJgDLOm3YXVn0o=; b=T/qN/D2xohKCqynDrL0l0uMbiRY+9nW4HJyQJviuuTf0JoRynTMhEPgWFEDiHzX+jq qYxnf5x+R7IQKAwstWrW+MJDlop88U62hRWSqDAojShOXvrxlkx/VYAv/fmHiznAYP4O clbiXZQ0UyysEklDT2Tg53zyAyLFcuftk6qZgZlpcGq+xUsZV82HTd+NetiWrrSuoPt8 bsNBohTFLm7jMHeeTGRNnSo2QG2hzDRhn4kPlCdU9sPwWZ0jKpH6CfDo+zPOftjwtpnp CwijzX+w3Xjwz1mb+x9b/eqT6UHEvRSBmOi77943tjnu4PvDXv7vg8AWTR6GdiZoTbSD 1cDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n3P2SzN2; spf=pass (google.com: domain of gcc-patches-return-506596-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-506596-patch=linaro.org@gcc.gnu.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o2si6588975pgp.288.2019.08.09.09.16.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Aug 2019 09:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-506596-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n3P2SzN2; spf=pass (google.com: domain of gcc-patches-return-506596-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-506596-patch=linaro.org@gcc.gnu.org" 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=bOmFMTZ4Z0GbzOgHuMcyE3Rcyr/JOiEUuBOpSrWQedNXpLu0Pw 9+a0SArvX56KTioan8WFCIsUDqYD+qgwVJaLNfoeYCGjwxAxhIb/j88Qok0Z14Oz GPuyfbBgQ33cuS17xjkgYPpYDRTURZm6hBOCfrWVwL4dbDuOsfhJDfPuA= 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=/EL5/HRFxlTQ01QplV1AbfVJCuw=; b=n3P2SzN2weGEtRnd89ZA jXL71nKhzR1R0DBQxesq3JuVuSzzPrQ3u8fFj6XoQiRgavlLl7SS0j0Qoj8Pdg6i D8lJtTcLAXIERKQHW8XUlFWMPoFNK7fSRCjy/v3i2wddVo4Z2LN75bmVnFPlgspD gVG88CEEgOIIuwOeCWbLjIQ= Received: (qmail 111006 invoked by alias); 9 Aug 2019 16:15:52 -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 110973 invoked by uid 89); 9 Aug 2019 16:15:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=91386, peephole2 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Aug 2019 16:15:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1725815A2; Fri, 9 Aug 2019 09:15:43 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.206.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B68253F575; Fri, 9 Aug 2019 09:15:42 -0700 (PDT) To: gcc-patches@gcc.gnu.org From: "Richard Earnshaw (lists)" Subject: [aarch64] PR target/91386 Use copy_rtx to avoid modifying original insns in peep2 pattern Message-ID: <25840eb1-d3d8-ff94-9cbb-eb44b3b4c363@arm.com> Date: Fri, 9 Aug 2019 17:15:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 PR target/91386 is a situation where a peephole2 pattern substitution is discarded late because the selected instructions contain frame-related notes that we cannot redistribute (because the pattern has more than one insn in the output). Unfortunately, the original insns were being modified during the generation, so after the undo we are left with corrupt RTL. We avoid this by ensuring that the modifications are always made on a copy, so that the original insns are never changed. PR target/91386 * config/aarch64/aarch64.c (aarch64_gen_adjusted_ldpstp): Use copy_rtx to preserve the contents of the original insns. Committed to trunk. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5bf182ccc0c..fdeca927153 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -18546,19 +18546,21 @@ aarch64_gen_adjusted_ldpstp (rtx *operands, bool load, /* Sort the operands. */ qsort (temp_operands, 4, 2 * sizeof (rtx *), aarch64_ldrstr_offset_compare); + /* Copy the memory operands so that if we have to bail for some + reason the original addresses are unchanged. */ if (load) { - mem_1 = temp_operands[1]; - mem_2 = temp_operands[3]; - mem_3 = temp_operands[5]; - mem_4 = temp_operands[7]; + mem_1 = copy_rtx (temp_operands[1]); + mem_2 = copy_rtx (temp_operands[3]); + mem_3 = copy_rtx (temp_operands[5]); + mem_4 = copy_rtx (temp_operands[7]); } else { - mem_1 = temp_operands[0]; - mem_2 = temp_operands[2]; - mem_3 = temp_operands[4]; - mem_4 = temp_operands[6]; + mem_1 = copy_rtx (temp_operands[0]); + mem_2 = copy_rtx (temp_operands[2]); + mem_3 = copy_rtx (temp_operands[4]); + mem_4 = copy_rtx (temp_operands[6]); gcc_assert (code == UNKNOWN); }