From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id C883E3857422 for ; Wed, 25 Aug 2021 15:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C883E3857422 Received: by mail-qk1-x730.google.com with SMTP id a66so8823860qkc.1 for ; Wed, 25 Aug 2021 08:20:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UWQSukRQNmykZ2x2sorlUKKF6HByNZpYURKHZlMfzhE=; b=DoyiGIF7Xc6mO+gH7cMAozDiE1/Yoq3zk/WQkVHGIg/HqGXzMOkQqlAU/Pt02Ym+nJ wHM4hPLHN8M4ZSYmpe5Kq7ATeSIK1fpZUl2L3Szw8rG8gclLuvUA1AHOwtue8OE7QFQC IoC6q2RbETH9GxccDlMubXWf5LjGm+E2tTh5Rj6Ufms4IQvTAahCG4KrCza2ZX+n7dgn vPVEkN3bdmllm9iIZdzdOe/t/I1Xct6IJzUAg6QOH2huHdarNeaKFGSovFaFHymO3Vxc hQf1ruactdnXYxRXMIackL4OJg5nRnlK27Utx2qVSSsIy92ir+iwYCGebxCEABoV5CRC YkIg== X-Gm-Message-State: AOAM530o6mKX5le9T3bWmeNLSl6B7Oqt6W3bmO4KiJVl1AwYRXJt9R35 3HiNKr4rKVyL9Q5s8MKR8Y4= X-Google-Smtp-Source: ABdhPJx32Z/sbgbq092JhW3IegnRCKc1KosGYrIyJrcz2oosFpvO1S+se14kElYuPAALyKMwNTaH0g== X-Received: by 2002:a05:620a:1598:: with SMTP id d24mr31449099qkk.484.1629904823429; Wed, 25 Aug 2021 08:20:23 -0700 (PDT) Received: from [192.168.0.41] (97-118-104-61.hlrn.qwest.net. [97.118.104.61]) by smtp.gmail.com with ESMTPSA id j184sm201326qkd.74.2021.08.25.08.20.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Aug 2021 08:20:23 -0700 (PDT) Subject: [PING][PATCH] enable ranger and caching in pass_waccess From: Martin Sebor To: Andrew MacLeod , gcc-patches , Aldy Hernandez References: <9a041eca-97c3-f250-8bab-8fadc72cd283@gmail.com> <0109253d-45e9-5c59-210d-2edcf983e4b3@redhat.com> <71d7a933-6942-1598-0cdd-5413f03fc188@gmail.com> Message-ID: Date: Wed, 25 Aug 2021 09:20:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <71d7a933-6942-1598-0cdd-5413f03fc188@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 25 Aug 2021 15:20:34 -0000 Ping: Andrew, did I answer your questions? Do you (or anyone else) have any other comments on the latest patch below? https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577865.html On 8/20/21 4:16 PM, Martin Sebor wrote: > On 8/20/21 7:09 AM, Andrew MacLeod wrote: >> On 8/19/21 7:09 PM, Martin Sebor via Gcc-patches wrote: >>> The attached patch changes the new access warning pass to use >>> the per-function ranger instance.  To do that it makes a number >>> of the global static functions members of the pass (that involved >>> moving one to a later point in the file, increasing the diff; >>> the body of the function hasn't changed otherwise).  Still more >>> functions remain.  At the same time, the patch also enables >>> the simple pointer_query cache to avoid repeatedly recomputing >>> the properties of related pointers into the same objects, and >>> makes the cache more effective (trunk fails to cache a bunch of >>> intermediate results).  Finally, the patch enhances the debugging >>> support for the cache. >>> >>> Other than the ranger/caching the changes have no user-visible >>> effect. >> >> >> Why are you calling enable/disable ranger if you are passing a ranger >> instance around instead of using the get_range_query (cfun)->range* >> calls? > > The pass stores an instance of the pointer_query class which in > turn stores a pointer to range_query (which is a copy of the ranger). > So storing it also in pass_waccess isn't necessary and can be > removed.  I've made that change in the attached update.  I'm not > sure the corresponding pointer should at some point also be removed > from the pointer_query class and replaced by calls to get_range_query > (cfun).  If so, that would take some surgery to the strlen pass which > also uses pointer_query and isn't quite ready to make this switch. > > >> >> Are you planning to transition to using the get_range_query() >> interface instead of keeping a range_query pointer in the >> pointer_query class? > > This pass and to a smaller extent the pointer_query class that's > used by it and the strlen pass are still a work in progress. > I also still need to convert the strlen pass to use Ranger and > I expect it will take some changes to pointer_query.  So at that > point, if going through get_range_query (cfun) everywhere is what > you recommend, I'm happy to do it. > > Anyway, attached is an updated revision with the m_ranger member > removed and a few helpers changed to take a range_query argument > to use the pointer_query member instead.  It was retested on > x86_64-linux. > > Martin > > PS There has been an effort to get rid of global variables from GCC, > or, as the first step, to avoid accessing them directly(*).  If and > when that happens, it seems like each pass will have to store either > the ranger instance as a member (directly or indirectly, via a member > of a class that stores it) or the function passed to pass::execute() > if it wants to access either. > > [*] https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573975.html > The patch at the link above wasn't approved but IIUC removing globals > from GCC is still a goal.