From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20292 invoked by alias); 20 Nov 2015 01:41:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19096 invoked by uid 89); 20 Nov 2015 01:41:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 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, 20 Nov 2015 01:41:30 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id A9C9CC813; Fri, 20 Nov 2015 01:41:29 +0000 (UTC) Received: from localhost.localdomain (vpn1-6-42.ams2.redhat.com [10.36.6.42]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAK1fSDQ005289; Thu, 19 Nov 2015 20:41:28 -0500 Subject: Re: [PATCH][RTL-ree] PR rtl-optimization/68194: Restrict copy instruction in presence of conditional moves To: Kyrill Tkachov , GCC Patches References: <5649E333.4090904@arm.com> <564A2339.3030308@redhat.com> <564AEE94.3070708@arm.com> <564B1934.6050300@redhat.com> <564B259A.90206@arm.com> <564BB42C.1020401@redhat.com> <564C40D1.80409@arm.com> <564DA454.2080704@arm.com> Cc: Jeff Law From: Bernd Schmidt Message-ID: <564E7A47.1090404@redhat.com> Date: Fri, 20 Nov 2015 01:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <564DA454.2080704@arm.com> Content-Type: multipart/mixed; boundary="------------020806050607020507010009" X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg02440.txt.bz2 This is a multi-part message in MIME format. --------------020806050607020507010009 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1342 >> I1 is def_insn, I3 is cand->insn. tmp_reg is 'ax'. What we want to do >> is reject this transformation >> because the destination of def_insn (aka I1), that is 'ax', is not the >> operand of the extend operation >> in cand->insn (aka I3). As you said, rtx_equal won't work on just >> SET_SRC (PATTERN (cand->insn)) because >> it's an extend operation. So reg_overlap_mentioned should be appropriate. Yeah, so just use the src_reg variable for the comparison. I still don't see why you wouldn't want to use the stronger test. But the whole thing still feels not completely ideal somehow, so after reading through ree.c for a while and getting a better feeling for how it works, I think the following (which you said is equivalent) would be the most understandable and direct fix. You said that the two tests should be equivalent, and I agree. I've not found cases where the change makes a difference, other than the testcase. Would you mind running this version through the testsuite and committing if it passes? I've shrunk the comment; massive explanations like this for every bug are inappropriate IMO, and the example also duplicates an earlier comment in the same function. And, as I said earlier, the way you placed the comment is confusing because only one part of the following if statement is related to it. Bernd --------------020806050607020507010009 Content-Type: text/x-patch; name="ree-copies.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ree-copies.diff" Content-length: 677 diff --git a/gcc/ree.c b/gcc/ree.c index 4550cc3..2c9d4d6 100644 --- a/gcc/ree.c +++ b/gcc/ree.c @@ -772,6 +772,12 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state) if (state->defs_list.length () != 1) return false; + /* We don't have the structure described above if there are + conditional moves in between the def and the candidate, + and we will not handle them correctly. See PR68194. */ + if (state->copies_list.length () > 0) + return false; + /* We require the candidate not already be modified. It may, for example have been changed from a (sign_extend (reg)) into (zero_extend (sign_extend (reg))). --------------020806050607020507010009--