From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74422 invoked by alias); 20 Apr 2019 21:54:19 -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 74413 invoked by uid 89); 20 Apr 2019 21:54:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=savings, hello!, tiny, H*Ad:U*vmakarov 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 ESMTP; Sat, 20 Apr 2019 21:54:18 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC70330821A5; Sat, 20 Apr 2019 21:54:16 +0000 (UTC) Received: from [10.64.242.17] (unknown [10.64.242.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56B3760BEC; Sat, 20 Apr 2019 21:54:15 +0000 (UTC) Subject: Re: [PATCH, LRA]: Revert the revert of removal of usless move insns. To: Uros Bizjak Cc: "gcc-patches@gcc.gnu.org" , Jeff Law , "H.J. Lu" References: <6d8d4025-5564-922e-912c-3ac1f812c132@redhat.com> From: Vladimir Makarov Message-ID: <2907e871-7c16-2705-8aec-df5d4f41e6ba@redhat.com> Date: Sat, 20 Apr 2019 22:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00835.txt.bz2 On 4/20/19 4:55 AM, Uros Bizjak wrote: > On 4/20/19, Vladimir Makarov wrote: >> On 11/21/18 2:33 PM, Uros Bizjak wrote: >>> Hello! >>> >>> Before the recent patch to post-reload mode switching, vzeroupper >>> insertion depended on the existence of the return copy instructions >>> pair in functions that return a value. The first instruction in the >>> pair represents a move to a function return hard register, and the >>> second was a USE of the function return hard register. Sometimes a nop >>> move was generated (e.g. %eax->%eax) for the first instruction of the >>> return copy instructions pair and the patch [1] teached LRA to remove >>> these useless instructions on the fly. >>> >>> The removal caused optimize mode switching to trigger the assert, >>> since the first instruction of a return pair was not found. The >>> relevant part of the patch was later reverted. With the recent >>> optimize mode switching patch, this is no longer necessary for >>> vzeroupper insertion pass, so attached patch reverts the revert. >>> >>> 2018-11-21 Uros Bizjak >>> >>> Revert the revert: >>> 2013-10-26 Vladimir Makarov >>> >>> Revert: >>> 2013-10-25 Vladimir Makarov >>> >>> * lra-spills.c (lra_final_code_change): Remove useless move insns. >>> >>> Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. >>> >>> OK for mainline? >> Sure, Uros. I support the patch. But I think it would be wise to >> postpone its committing after releasing GCC-9. Simply it is hard to >> predict the patch effect to other targets and I would avoid any risk at >> this stage. > Actually, the "revert of the revert" patch was already committed to > mainline some time ago. Sorry for confusion, Uros. I did not check the date of your original posting.  Insn removal was added to RA just to avoid wasting CPU cycles on such insn processing afterwards.  Such insns are removed anyway later in the pass pipeline.  The CPU time savings are tiny but the removal creates too many problems including new one PR90178.  I should have avoided to put this code in the first place. I think we should remove this code forever. It is not convenient for me to do this now because I am traveling.  If somebody wants to remove the code, i am approving this in advance. > To clear the possible misunderstanding, let me summarise the issue: > > - the original patch that remove useless move insn caused a breakage > in vzeroupper pass. > - the original patch was reverted due to the above breakage > - the vzeroupper pass was later adjusted to tolerate removed useless > move instructions, and this cleared the way to revert the revert. Now > LRA removes useless move insns. > > An orthogonal issue (PR90178) was discovered, showing that some passes > also depend on the presence of useless move insn. > > The bisection stumbled on the "revert of the revert" patch that > (obviously) re-introduced the issue. I'm not in the position to decide > if useless move insn can be removed or if these later passes should be > fixed, I can only say that the vzeroupper pass is now agnostic to the > presence of useless move insns. > > Uros.