From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45897 invoked by alias); 16 Nov 2015 18:41:01 -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 45884 invoked by uid 89); 16 Nov 2015 18:41:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 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; Mon, 16 Nov 2015 18:41:00 +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 4AD62935D4; Mon, 16 Nov 2015 18:40:59 +0000 (UTC) Received: from localhost.localdomain (vpn1-5-35.ams2.redhat.com [10.36.5.35]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAGIevO6001678; Mon, 16 Nov 2015 13:40:58 -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> Cc: Jeff Law From: Bernd Schmidt Message-ID: <564A2339.3030308@redhat.com> Date: Mon, 16 Nov 2015 18: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: <5649E333.4090904@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg01984.txt.bz2 On 11/16/2015 03:07 PM, Kyrill Tkachov wrote: > I've explained in the comments in the patch what's going on but the > short version is trying to change the destination of a defining insn > that feeds into an extend insn is not valid if the defining insn > doesn't feed directly into the extend insn. In the ree pass the only > way this can happen is if there is an intermediate conditional move > that the pass tries to handle in a special way. An equivalent fix > would have been to check on that path (when copy_needed in > combine_reaching_defs is true) that the state->copies_list vector > (that contains the conditional move insns feeding into the extend > insn) is empty. I ran this through gdb, and I think I see what's going on. For reference, here's a comment from the source: /* Considering transformation of (set (reg1) (expression)) ... (set (reg2) (any_extend (reg1))) into (set (reg2) (any_extend (expression))) (set (reg1) (reg2)) ... */ I was thinking that another possible fix would be to also check !reg_used_between_p for reg1 to ensure it's not used. I'm thinking this might be a little clearer - what is your opinion? The added comment could lead to some confusion since it's placed in front of an existing if statement that also tests a different condition. Also, if we go with your fix, > + || !reg_overlap_mentioned_p (tmp_reg, SET_SRC (PATTERN (cand->insn)))) Shouldn't this really be !rtx_equal_p? Bernd