From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id D786E3858CDB for ; Fri, 14 Jul 2023 05:35:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D786E3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1b8a8154f9cso9580935ad.1 for ; Thu, 13 Jul 2023 22:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689312917; x=1691904917; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vZCd0V0/MUCVWgk5t5UrL0wSfJ30VEP2no3ETpdBSV4=; b=WAkYnpPPAC1WMrbP0BCChR6f6EbDCV2uBdCtEgDWFHERKkSkJjL9c5Q30epOrfNEm2 cbqPc+IO1w/ee4mRH96J0sbRlKm1vZx3U/YRkghIkRFUsWYZarsyW2VBQxz/rPtjyAiV S2otyuy+8LYxD10cV7J4RjtIn8ETlSnO3A5hlaFZVRP7WAh130GNKHrBgs1jRGU0F4pd bUpAopC72eksLRQEielVbrY/xsxPC7DiL0y8WG8A9yBqWvr5gb/VXGSzUpFdQzvg5FKr EdvzM9oUqlogcm338JunF5+ZHTTi5iBs5pDDSEzPhhJblzok5SnUL5KsmIq9/7eIXDRs 8klw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689312917; x=1691904917; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vZCd0V0/MUCVWgk5t5UrL0wSfJ30VEP2no3ETpdBSV4=; b=YFGMKSpkr7+Uvt28D8tDuU4wtvEgT3QRn1sMPO9qhzsOxRlx4P9I1d0QQcbCh3Ff6Z ecJu/Z6MfSZu+TGN0sxYxhQ1G2D90tUGSETYhWmtVIFDs2ht8HbXCxYMbXtlLa0CcTb0 eJU8Ko8UolDRmu56UxNDzXcEwi1uOAMOlBUD6KKv2U8vXKsZkqrwg/gnLl8U9wgmLTpP TXLBPkFQiq48QdPIavwmWfadfEqhNFwlHGhamQCVQrW7xhmTNnRTKYraGK063tiHLiH8 FpNIPI80vzr/WwL3gUFsXi+wA/B63LR6aa0F1e9dwqQxmwuEQByuVyOWRDf4Fpkyw3hH Vb3w== X-Gm-Message-State: ABy/qLZ7oXoLjshAuCRxvhcsQ2OoEX4FSvxVmOagzZiy7s6T+CMEcQxN Rj8Es9v/ELTmfE3ek87nm0E= X-Google-Smtp-Source: APBJJlFNKredFFdKjrlDcC4saMY+Z+zXHHJBsU0XNRiJjGTj284k6W+ljVyVS8hrQUqklna393IepQ== X-Received: by 2002:a17:902:e750:b0:1b8:6952:5381 with SMTP id p16-20020a170902e75000b001b869525381mr2583932plf.9.1689312916532; Thu, 13 Jul 2023 22:35:16 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id l3-20020a170902cf8300b001b9ce2c3baesm6816898ply.143.2023.07.13.22.35.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jul 2023 22:35:15 -0700 (PDT) Message-ID: <1420ed26-9c30-b09e-f45c-54c89516814e@gmail.com> Date: Thu, 13 Jul 2023 23:35:14 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3] Implement new RTL optimizations pass: fold-mem-offsets. Content-Language: en-US To: Manolis Tsamis , gcc-patches@gcc.gnu.org Cc: Philipp Tomsich , Richard Biener , Jakub Jelinek References: <20230713141336.3950751-1-manolis.tsamis@vrull.eu> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 7/13/23 09:05, Manolis Tsamis wrote: > In this version I have made f-m-o able to also eliminate constant > moves in addition to the add constant instructions. > This increases the number of simplified/eliminated instructions and is > a good addition for RISC style ISAs where these are more common. > > This has led to pr52146.c failing in x86, which I haven't been able to > find a way to fix. > This involves directly writing to a constant address with -mx32 > > The code > movl $-18874240, %eax > movl $0, (%eax) > > is 'optimized' to > movl $0, %eax > movl $0, -18874240(%eax) > > Which is actually > movl $0, -18874240 > > which is wrong per the ticket. > The fix for the ticket involved changes to legitimate_address_p which > f-m-o does call but it doesn't reject due to the existence of (%eax) > which in turn is actually zero. > I believe this is not strictly an f-m-o issue since the pass calls all > the required functions to test whether the newly synthesized memory > instruction is valid. > > Any ideas on how to solve this issue is appreciated. I wonder if costing might be useful here. I would expect the 2nd sequence is the most costly of the three if address costing models are reasonably accurate. Another way would be to look at the length of the memory reference insn. If it's larger, then it's likely more costly. That's what I've got off the top of my head. Jeff