From patchwork Fri Nov 27 09:45:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 57357 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1024260lbb; Fri, 27 Nov 2015 01:45:41 -0800 (PST) X-Received: by 10.66.162.38 with SMTP id xx6mr66686172pab.57.1448617541660; Fri, 27 Nov 2015 01:45:41 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id cm4si15409286pad.81.2015.11.27.01.45.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Nov 2015 01:45:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-415612-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; spf=pass (google.com: domain of gcc-patches-return-415612-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-415612-patch=linaro.org@gcc.gnu.org; dkim=pass header.i=@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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=J0v/k+b8BDN7UCarAoZWzkMfbM1gKCxbJ9Gv9GP0dc5 bUASohTDoKeVs6aNe7UqCL3c7AnKzL0GNb3+p4utlCuLpq4UxXZBSW+RiqE3WcCy KyG0pqa9lrpkicOSnUABEKWxD6M1h0J8TpJUawM0SSXH10uH5O3lKdensusH4nHI = 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:cc:subject:content-type; s=default; bh=W4N4qBgeNBXu6Ee4W8v0kCBrbfc=; b=eispnIVhAKpmHjvuh rRonKL4jCbADymbuGw0jYkKAk1dinc5H+o5FXPhPnFYF6HJZy4lPuF6Yp9yatw05 TKw0Wx4uQ8vgN/Ao5rincvFcRF5qerhCv3pvfVSCm7XH8cFUXJ8iEKf8SLN9vyWi WDmDaEcz0MUaCff+JQnzJ7LwJA= Received: (qmail 62360 invoked by alias); 27 Nov 2015 09:45:29 -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 62348 invoked by uid 89); 27 Nov 2015 09:45:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Nov 2015 09:45:27 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-37-QqmNZfHgTjeHZ4RLg1-JPw-1; Fri, 27 Nov 2015 09:45:19 +0000 Received: from [10.2.206.200] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 27 Nov 2015 09:45:18 +0000 Message-ID: <5658262E.20903@arm.com> Date: Fri, 27 Nov 2015 09:45:18 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Bernd Schmidt Subject: [PATCH][RTL-ifcvt] Reject insns that are multiple_sets X-MC-Unique: QqmNZfHgTjeHZ4RLg1-JPw-1 X-IsSubscribed: yes Hi all, As discussed, I've added a check for multiple_sets to insn_valid_noce_process_p and replaced the modified_a and modified_b redundant definitions with checking asserts to catch cases if any unexpected multiple sets get through the net. Bootstrapped and tested on arm, aarch64, x86_64. As expected, I didn't see any codegen difference as it should a pretty rare case for which we have no reported testcase. Ok for trunk? Thanks, Kyrill 2015-11-27 Kyrylo Tkachov * ifcvt.c (insn_valid_noce_process_p): Reject insn if it satisfies multiple_sets. (noce_try_cmove_arith): Add checking asserts that orig_a and orig_b are not modified by the final modified insns in the basic blocks diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 3ce9fe6082069361504268788c009eec722ac89b..ef3ebe359a3ef80965f9827c67a7cb6b0dca1442 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -1880,6 +1880,7 @@ insn_valid_noce_process_p (rtx_insn *insn, rtx cc) { if (!insn || !NONJUMP_INSN_P (insn) + || multiple_sets (insn) || (cc && set_of (cc, insn))) return false; @@ -2206,7 +2207,7 @@ noce_try_cmove_arith (struct noce_if_info *if_info) swap insn that sets up A with the one that sets up B. If even that doesn't help, punt. */ - modified_in_a = emit_a != NULL_RTX && modified_in_p (orig_b, emit_a); + gcc_checking_assert (!emit_a || !modified_in_p (orig_b, emit_a)); if (tmp_b && then_bb) { FOR_BB_INSNS (then_bb, tmp_insn) @@ -2222,7 +2223,7 @@ noce_try_cmove_arith (struct noce_if_info *if_info) } if (emit_a || modified_in_a) { - modified_in_b = emit_b != NULL_RTX && modified_in_p (orig_a, emit_b); + gcc_checking_assert (!emit_b || !modified_in_p (orig_a, emit_b)); if (tmp_b && else_bb) { FOR_BB_INSNS (else_bb, tmp_insn)