From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37928 invoked by alias); 24 Jul 2019 19:50:23 -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 37752 invoked by uid 89); 24 Jul 2019 19:50:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,SPF_HELO_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.1 spammy=dangerous, H*c:alternative 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; Wed, 24 Jul 2019 19:50:22 +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 B5D9530C1E1C; Wed, 24 Jul 2019 19:50:20 +0000 (UTC) Received: from [10.10.120.25] (ovpn-120-25.rdu2.redhat.com [10.10.120.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48EB260C05; Wed, 24 Jul 2019 19:50:17 +0000 (UTC) Subject: Re: [range-ops] patch 01/04: types for VR_UNDEFINED and VR_VARYING To: Jeff Law , Richard Biener Cc: Aldy Hernandez , gcc-patches References: <481033aa-6ecc-3bcb-c874-becee14c5605@redhat.com> <27d3db25-ea95-33f4-57fb-e9a4a40d7341@redhat.com> <1a0a328e-74bb-15cb-40fb-09944fe2b84c@redhat.com> <3ebd8a38-9478-7899-5067-b4cb220d2edf@redhat.com> <828e67b6-d52c-f50d-27bb-46b3734a0493@redhat.com> From: Andrew MacLeod Message-ID: <720577a0-adf6-71d2-3686-66831dcc5d59@redhat.com> Date: Wed, 24 Jul 2019 20:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <828e67b6-d52c-f50d-27bb-46b3734a0493@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg01608.txt.bz2 On 7/24/19 2:18 PM, Jeff Law wrote: > On 7/24/19 11:00 AM, Richard Biener wrote: > [ Big snip, ignore missing reply attributions... ] > >>> it. But I'd claim that if callers are required not to change these >>> ranges, then the callers are fundamentally broken. I'm not sure >>> what the "sanitization" is really buying you here. Can you point >>> to something specific? >>> >>>> But you lose the sanitizing that nobody can change it and the >>>> changed info leaks to other SSA vars. >>>> >>>> As said, fix all callers to deal with NULL. >>>> >>>> But I argue the current code is exactly optimal and safe. >>> ANd I'd argue that it's just plain broken and that the >>> sanitization you're referring to points to something broken >>> elsewhere, higher up in the callers. >> Another option is to make get_value_range return by value and the >> only way to change the lattice to call an appropriate set function. I >> think we already do the latter in all cases (but we use >> get_value_range in the setter) and returning by reference is just >> eliding the copy. > OK, so what I think you're getting at (and please correct me if I'm > wrong) is that once the lattice values are set, you don't want something > changing the recorded ranges underneath? > > ISTM the way to enforce that is to embed the concept in the class and > enforce it by not allowing direct manipulation of range by the clients. > So a client that wants this behavior somehow tells the class that > ranges are "set in stone" and from that point the setters don't allow > changing the underlying ranges. > > I just want to make sure we're on the same page WRT why you think the > constant varying range object is useful. > > jeff That is not the functionality we are seeing. whenever get_value_range silently returns a CONST varying node,  the ONLY way you can tell that the node might possibly be const elsewhere would be if you first check that it is varying, like in  : void vr_values::set_defs_to_varying (gimple *stmt) {   ssa_op_iter i;   tree def;   FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)     {       value_range *vr = get_value_range (def);       /* Avoid writing to vr_const_varying get_value_range may return.  */       if (!vr->varying_p ())         vr->set_varying ();     } } Which means there can be *no* context in which we ever try move one of these nodes from varying to anything else, or we'd trap on a write to read-only space. Which means no place is ever trying to change those nodes from varying to anything else.  But nothing is preventing changes from other ranges to something else. Which also means the only thing this approach accomplishes is to force us to check if a node is already varying, so that we don't overwrite the node to varying just in case its a hidden const. how can this hidden const node really be useful? I submit this is just a dangerous way to flag previously unprocessed nodes as VARYING for the duration of the pass after values_propagated is set...  not some higher level "Don't change this range any more" plan.  Its already bottom of the lattice..  it isn't going anywhere. Andrew