From patchwork Fri Jun 14 19:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1948121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M6Xx5moL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W18JP72SWz20Pb for ; Sat, 15 Jun 2024 05:20:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4BDC6388266A for ; Fri, 14 Jun 2024 19:20:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 07F02388211C for ; Fri, 14 Jun 2024 19:20:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 07F02388211C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 07F02388211C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718392827; cv=none; b=pG3BJM8z1pDqeF4aY0gC48iZu6bMWHyJtMUwXbnqypoj9HgftVENS7ykogbLChh8bYIsj9JbciDefzDpWsOUT1VRrEPB1YrAnXijTo9QXznXm/2+5G+/WSCtAZqAgWtz/u3lNOO7ozzHywyLKOtYXUV6EkR6x7nEEDh7bHDWj0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718392827; c=relaxed/simple; bh=1ICeB07Dzz2D0JV4JWcn8qrAFHa+NHziI34drxCQxBw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=B/PXPx0Se7Q8U4OFyH/UDrbL7vANGt95nzeXS8MOg3Q+zAQrJ09U4luy0x+OhRFUxzy20yn8MbH1dnygFfDD58yyCOq5VPHJPwLPapitBOEdi7HoLHXu7CwYw9fQbm51+Dp1VJX/ynD2vxPkeTingjrOIUzE7DNOJc3Y/MMR0/s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718392825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=9bCKokgryW+EGwAB8UPApOuXVhagjOlAYum5RrZhXw4=; b=M6Xx5moLftq9xbVQX3K/7TngD9+h2dA99l5+fdlKUhAolRU6NhQ3O7McG91sjet70HpUA2 UocdiNTHrTXKsqKkEroWrSsFIj13en34XlErS08WkEouRCqWNmhjmpOUVuXG2PtnPGEMBT 84IldNRahWDZjtth0jkM1vG4nI5b/2Q= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-427-sD78BQ6SPLGX8V_kj8XxCw-1; Fri, 14 Jun 2024 15:20:24 -0400 X-MC-Unique: sD78BQ6SPLGX8V_kj8XxCw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-792ff5345c6so221833285a.1 for ; Fri, 14 Jun 2024 12:20:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718392822; x=1718997622; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=11q+5h26kYQP/ySF177qQWROu562CKTU0pteS7fLqrA=; b=bDYzuDo1ereUSIDfJ55vf77VuOMa6uYob63NrgtZMNf1jsFMrwLndBUPUK9UWMbrL7 z4y5xh/L6mJUyp066a6t87jXD+NReGOD9p9upa2xh3QZKU6t4FR4Y7rcKVi6LOcnqQgt 2OsgcEwxW2QBNlfUeTvHQK1aS0R5G/acxMMUs36Kv4KdQOUYmZGbSPMmoy9q6hjG/kWh xb3POBd5qhcBejWhSyv/otv2z8YYdOSNtsBfq0Dk8nOEOFvbKEa3ejpxGrrAP8fJkWtG aHSLiaWeqE5BPIvZzKqvGZtLW7x+FOpR2UW4vsb52ne2bsU22JOGRUCxpVOSsr/Dy509 bqFg== X-Gm-Message-State: AOJu0Yx42y1odygW6UWFTq/qaeSmgZ8CcW4OH2HmrHSUoRrZrN9AoOgV I6NvN363ziX7/Pisi7NLLnaPM6zTIlcEqOoOwqqazwPL/4uPZtqm7+xBnjN2Lm3EjqzcLz3WDzv MhXEbYJm4X5h24Qaep7YTo6ojG6zfy9Dglqw5/p+jCkgogWo+TKf2+Z5+E9DUD08Q6i4icJ5yce 7/KwUU91IGdIEGCGM4jf/OVGtlDJpsxgCW4q0SkeU= X-Received: by 2002:a05:620a:44c2:b0:796:af63:b7b2 with SMTP id af79cd13be357-798d26940femr368723285a.58.1718392822306; Fri, 14 Jun 2024 12:20:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8UFNSWFi8jDq9D6l9jgaNmk6LnkSCGcWNJuq6558lMBDJ672pqipraSy63ZUxzd5eP9ULdg== X-Received: by 2002:a05:620a:44c2:b0:796:af63:b7b2 with SMTP id af79cd13be357-798d26940femr368720185a.58.1718392821688; Fri, 14 Jun 2024 12:20:21 -0700 (PDT) Received: from [192.168.0.174] ([104.219.120.74]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798aaeebbebsm172633185a.47.2024.06.14.12.20.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jun 2024 12:20:21 -0700 (PDT) Message-ID: <88815a5d-7070-404c-af7c-2d646a82943f@redhat.com> Date: Fri, 14 Jun 2024 15:20:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: gcc-patches Cc: "hernandez, aldy" From: Andrew MacLeod Subject: [COMMITTED] Add merge facility to ssa_lazy_cache. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org The ssa_lazy_cache object has a routine to merge a range for an ssa-name with an existing range in the cache.  This adds a method which will merge all elements of another ssa_lazy_cache the ssa_lazy_cache is a reasonably efficient object for storing ranges associated a few ssa-names, and it is used in a few places by ranger. Bootstraps on   x86_64-pc-linux-gnu with no regressions.  There shouldn't be, there are no callers yet :-)   Pushed. Andrew From e2679227829ffe2ff4fb974994aacd639219f855 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 13 Jun 2024 15:35:55 -0400 Subject: [PATCH 2/7] Add merge facility to ssa_lazy_cache. The ssa_lazy_cache has a routine to merge a range for an ssa-name with an existing range in the cache. This adds a method which will merge all elements of another ssa_lazy_cache. * gimple-range-cache.cc (ssa_lazy_cache::merge): New. * gimple-range-cache.h (ssa_lazy_cache::merge): New prototype. --- gcc/gimple-range-cache.cc | 18 ++++++++++++++++++ gcc/gimple-range-cache.h | 1 + 2 files changed, 19 insertions(+) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index a511a2c3a4c..efaae2ed928 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -729,6 +729,24 @@ ssa_lazy_cache::merge_range (tree name, const vrange &r) return true; } +// Merge all elements of CACHE with this cache. +// Any names in CACHE that are not in this one are added. +// Any names in both are merged via merge_range.. + +void +ssa_lazy_cache::merge (const ssa_lazy_cache &cache) +{ + unsigned x; + bitmap_iterator bi; + EXECUTE_IF_SET_IN_BITMAP (cache.active_p, 0, x, bi) + { + tree name = ssa_name (x); + Value_Range r(TREE_TYPE (name)); + cache.get_range (r, name); + merge_range (ssa_name (x), r); + } +} + // Return TRUE if NAME has a range, and return it in R. bool diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index c7499f928a9..63410d5437e 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -87,6 +87,7 @@ public: virtual bool get_range (vrange &r, tree name) const; virtual void clear_range (tree name); virtual void clear (); + void merge (const ssa_lazy_cache &); protected: bitmap active_p; }; -- 2.45.0