From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EBA943858D28 for ; Fri, 12 Aug 2022 14:07:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBA943858D28 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-372-nfyO755cMAi1t841AFCFzA-1; Fri, 12 Aug 2022 10:07:16 -0400 X-MC-Unique: nfyO755cMAi1t841AFCFzA-1 Received: by mail-io1-f72.google.com with SMTP id f17-20020a6bdd11000000b00684f4e874b5so605833ioc.13 for ; Fri, 12 Aug 2022 07:07:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=gxvOh5bFx5x5ePQQIWj31AZalOGS/Kkf0iBziWonOgc=; b=0rhWdPPCgPN2T5HjdQ9z+MPfir9Np1QnVO++UVNcTJWoeYEfYp8kde1eMUhg94pF8C IbnhjEi4eRLCFhVKM4l9AzeBn7/yk+i4apla6RgboRkCeWrc+iLXZaZ7kBMbBOHCvRI7 qsZr9h/Zuxrk5Ttq0MiE5Sub1WDhvChmIY4BNGdQdyH6ya2XiDrRwPnU0F1WNdLA4nlQ mtRRb0Gh+N8C2Cqin8ZwWZd1d70VtgPWHCT+jI6bXe56KVVcTS3pOl0Ntr6YQ5lCAxCS e29g1LXRwK2LCM2Ng8vR5BiCsIE4I1QzPS0x1QzFkDGuYwA8p6kiTL+pfapj4meHphKD qpJQ== X-Gm-Message-State: ACgBeo3Dn3YrYh5io6hjjiBk6JAsuCwvK18CzKXxiUrlJmtB/oGwv3sW rMPAoJUcOV9bpLuxDXkvdpgxj8KWB01ER4ATwy5mnXfvF94P+lYFNRWUSmRYNi/b6KlF0zW2HPV 1KuaZ5dqWiu6Lj8AsMw== X-Received: by 2002:a05:6e02:18cb:b0:2de:9b40:2147 with SMTP id s11-20020a056e0218cb00b002de9b402147mr1824181ilu.127.1660313235622; Fri, 12 Aug 2022 07:07:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR7wgt1/An7pQx1yhEjyr42ynqHQLOcYa6/UusKfcCXJvsTn1siZtmvQrkPtQ5EKM8wTPWMmlA== X-Received: by 2002:a05:6e02:18cb:b0:2de:9b40:2147 with SMTP id s11-20020a056e0218cb00b002de9b402147mr1824170ilu.127.1660313235374; Fri, 12 Aug 2022 07:07:15 -0700 (PDT) Received: from [192.168.0.135] ([192.24.49.145]) by smtp.gmail.com with ESMTPSA id v18-20020a02b912000000b003429d62b90csm1036978jan.29.2022.08.12.07.07.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Aug 2022 07:07:14 -0700 (PDT) Message-ID: <8bf88bc2-9bd5-f4d3-7207-066a973d13fd@redhat.com> Date: Fri, 12 Aug 2022 10:07:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] tree-optimization/106593 - fix ICE with backward threading From: Andrew MacLeod To: Aldy Hernandez , Richard Biener Cc: gcc-patches References: <20220812105937.227C413305@imap2.suse-dmz.suse.de> <1d535caf-2451-b648-08ad-51776bc35ab8@redhat.com> In-Reply-To: <1d535caf-2451-b648-08ad-51776bc35ab8@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2022 14:07:19 -0000 On 8/12/22 09:38, Andrew MacLeod wrote: > > On 8/12/22 07:31, Aldy Hernandez wrote: >> On Fri, Aug 12, 2022 at 12:59 PM Richard Biener >> wrote: >>> With the last re-org I failed to make sure to not add SSA names >>> nor supported by ranger into m_imports which then triggers an >>> ICE in range_on_path_entry because range_of_expr returns false.  I've >>> noticed that range_on_path_entry does mightly complicated things >>> that don't make sense to me and the commentary might just be >>> out of date.  For the sake of it I replaced it with range_on_entry >>> and statistics show we thread _more_ jumps with that, so better >>> not do magic there. >> Hang on, hang on.  range_on_path_entry was written that way for a >> reason.  Andrew and I had numerous discussions about this.  For that >> matter, my first implementation did exactly what you're proposing, but >> he had reservations about using range_on_entry, which IIRC he thought >> should be removed from the (public) API because it had a tendency to >> blow up lookups. >> >> Let's wait for Andrew to chime in on this.  If indeed the commentary >> is out of date, I would much rather use range_on_entry like you >> propose, but he and I have fought many times about this... over >> various versions of the path solver :). > > The original issue with range-on-entry is one needed to be very > careful with it.  If you ask for range-on-entry of something which is > not dominated by the definition, then the cache filling walk was > getting filled all the way back to the top of the IL, and that was > both a waste of time and memory., and in some pathological cases was > outrageous.  And it was happening more frequently than one imagines... > even if accidentally.  I think the most frequent accidental misuse we > saw was calling range on entry for a def within the block, or a PHI > for the block. > > Its a legitimate issue for used before defined cases, but there isnt > much we can do about those anyway, > > range_of_expr on any stmt within a block, when the definition comes > from outside he block causes ranger to trigger its internal > range-on-entry "more safely", which is why it didn't need to be part > of the API... but i admit it does cause some conniptions when for > instance there is no stmt in the block. > > That said, the improvements since then to the cache to be able to > always use dominators, and selectively update the cache at strategic > locations probably removes most issues with it. That plus we're more > careful about timing things these days to make sure something horrid > isn't introduced.  I also notice all my internal range_on_entry and > _exit routines have evolved and are much cleaner than they once were. > > So. now that we are sufficiently mature in this space...  I think we > can promote range_on_entry and range_on_exit to full public API..  It > does seem that there is some use practical use for them. > > Andrew > > PS. It might even be worthwhile to add an assert to make sure it isnt > being called on the def block.. just to avoid that particular stupidty > :-)   I'll take care of doing this. > > Actually, as I look at it, perhaps better to leave things as they are.. ie, not promote it to a part of the range_query API.. that appears fraught with derived issues in other places. Continue to leave it in rangers public API and anyone using a ranger can use it. I will add the assert to make sure its not abused in the common way of the past. And yes, this will dramatically simplify the path_entry routine :-) Andrew