From patchwork Fri Feb 12 01:28:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 582087 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 24920140BA5 for ; Fri, 12 Feb 2016 12:28:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=alRAX8H4; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :references:to:from:subject:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=WzUR3R0U45hi/1NpQ upDyxkZxBdAzj8aE/Dn6lHjAVOXUQkX+HAi+ZTJf64xOSzWVmYToVD+/NhpqAKpt 35ptEUgHHArqJ/MkmgfoQ6xNpTBFPTBYwloW7bJOqBz+rMUmWAErrpGTd6SQcFaC UdPFJvVU1WrN1FtpRzpsFDi+A0= 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 :references:to:from:subject:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=ucl1M5eBx7DQFYMXOeyYXtu 1724=; b=alRAX8H4KYbF467u7q8w+SErbQjOVtctSubV3QPyXEoat8S+TOb5jyV cqMBfiK/6yDMqUZ6v4jpRFoERk1kfZM+I1ycJAPK4IGyJ37Wa4fviFzt8ilR1Rsb GzCdb0m2nyZ/Xhcnp8h9qQSi9cFNW3ldGU8RO5kqRqg5Tnsnr3Nc= Received: (qmail 120501 invoked by alias); 12 Feb 2016 01:28:49 -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 120490 invoked by uid 89); 12 Feb 2016 01:28:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=destinations, equivalence 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; Fri, 12 Feb 2016 01:28:47 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 900BB96F9 for ; Fri, 12 Feb 2016 01:28:46 +0000 (UTC) Received: from localhost.localdomain (vpn1-6-234.ams2.redhat.com [10.36.6.234]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1C1SjTB029421 for ; Thu, 11 Feb 2016 20:28:46 -0500 References: <56BD320A.6090203@t-online.de> To: GCC Patches From: Bernd Schmidt Subject: Fix PR69752, insn with REG_INC being removed as equiv_init insn X-Forwarded-Message-Id: <56BD320A.6090203@t-online.de> Message-ID: <56BD354D.3000803@redhat.com> Date: Fri, 12 Feb 2016 02:28:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56BD320A.6090203@t-online.de> X-IsSubscribed: yes This seems fairly straightforward: (insn 213 455 216 6 (set (reg:SI 266) (mem/u/c:SI (post_inc:SI (reg/f:SI 267)) [4 S4 A32])) 748 {*thumb1_movsi_insn} (expr_list:REG_EQUAL (const_int -1044200508 [0xffffffffc1c2c3c4]) (expr_list:REG_INC (reg/f:SI 267) (nil)))) We don't notice that the SET_SRC has a side effect, record the insn as an equivalencing one, and later remove it because we replaced the reg with the constant everywhere. Thus, the increment doesn't take place. Fixed as follows. Bootstrapped and tested on x86_64-linux. Also compared before/after dumps for the testcase with arm-elf. Ok? Bernd PR rtl-optimization/69752 * ira.c (update_equiv_regs): When looking for more than a single SET, also take other side effects into account. Index: gcc/ira.c =================================================================== --- gcc/ira.c (revision 233364) +++ gcc/ira.c (working copy) @@ -3392,7 +3392,8 @@ update_equiv_regs (void) /* If this insn contains more (or less) than a single SET, only mark all destinations as having no known equivalence. */ - if (set == NULL_RTX) + if (set == NULL_RTX + || side_effects_p (SET_SRC (set))) { note_stores (PATTERN (insn), no_equiv, NULL); continue;