public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-7592] tree-optimization/102943 - use tree form for sbr_sparse_bitmap
Date: Thu, 10 Mar 2022 13:42:10 +0000 (GMT)	[thread overview]
Message-ID: <20220310134210.B98D53857C5D@sourceware.org> (raw)

https://gcc.gnu.org/g:ee34ffa429a399f292ad1421333721a92b998772

commit r12-7592-gee34ffa429a399f292ad1421333721a92b998772
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Mar 10 13:43:19 2022 +0100

    tree-optimization/102943 - use tree form for sbr_sparse_bitmap
    
    The following arranges to remove an indirection do the bitvector
    in sbr_sparse_bitmap by embedding bitmap_head instead of bitmap
    and using the tree form (since we only ever set/query individual
    aligned bit chunks).  That shaves off 6 seconds from 70 seconds
    of the slowest 521.wrf_r LRANS unit build.
    
    2022-03-10  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/102943
            * gimple-range-cache.cc (sbr_sparse_bitmap::bitvec):
            Make a bitmap_head.
            (sbr_sparse_bitmap::sbr_sparse_bitmap): Adjust and switch
            to tree view.
            (sbr_sparse_bitmap::set_bb_range): Adjust.
            (sbr_sparse_bitmap::get_bb_range): Likewise.

Diff:
---
 gcc/gimple-range-cache.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 613135266a4..583ba29eb63 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -313,7 +313,7 @@ private:
   int bitmap_get_quad (const_bitmap head, int quad);
   irange_allocator *m_irange_allocator;
   irange *m_range[SBR_NUM];
-  bitmap bitvec;
+  bitmap_head bitvec;
   tree m_type;
 };
 
@@ -324,7 +324,8 @@ sbr_sparse_bitmap::sbr_sparse_bitmap (tree t, irange_allocator *allocator,
 {
   gcc_checking_assert (TYPE_P (t));
   m_type = t;
-  bitvec = BITMAP_ALLOC (bm);
+  bitmap_initialize (&bitvec, bm);
+  bitmap_tree_view (&bitvec);
   m_irange_allocator = allocator;
   // Pre-cache varying.
   m_range[0] = m_irange_allocator->allocate (2);
@@ -370,7 +371,7 @@ sbr_sparse_bitmap::set_bb_range (const_basic_block bb, const irange &r)
 {
   if (r.undefined_p ())
     {
-      bitmap_set_quad (bitvec, bb->index, SBR_UNDEF);
+      bitmap_set_quad (&bitvec, bb->index, SBR_UNDEF);
       return true;
     }
 
@@ -380,11 +381,11 @@ sbr_sparse_bitmap::set_bb_range (const_basic_block bb, const irange &r)
       {
 	if (!m_range[x])
 	  m_range[x] = m_irange_allocator->allocate (r);
-	bitmap_set_quad (bitvec, bb->index, x + 1);
+	bitmap_set_quad (&bitvec, bb->index, x + 1);
 	return true;
       }
   // All values are taken, default to VARYING.
-  bitmap_set_quad (bitvec, bb->index, SBR_VARYING);
+  bitmap_set_quad (&bitvec, bb->index, SBR_VARYING);
   return false;
 }
 
@@ -394,7 +395,7 @@ sbr_sparse_bitmap::set_bb_range (const_basic_block bb, const irange &r)
 bool
 sbr_sparse_bitmap::get_bb_range (irange &r, const_basic_block bb)
 {
-  int value = bitmap_get_quad (bitvec, bb->index);
+  int value = bitmap_get_quad (&bitvec, bb->index);
 
   if (!value)
     return false;
@@ -412,7 +413,7 @@ sbr_sparse_bitmap::get_bb_range (irange &r, const_basic_block bb)
 bool
 sbr_sparse_bitmap::bb_range_p (const_basic_block bb)
 {
-  return (bitmap_get_quad (bitvec, bb->index) != 0);
+  return (bitmap_get_quad (&bitvec, bb->index) != 0);
 }
 
 // -------------------------------------------------------------------------


                 reply	other threads:[~2022-03-10 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220310134210.B98D53857C5D@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).