public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8749] Adjust on_entry cache to indicate if the value was set properly.
@ 2021-07-14 21:58 Andrew Macleod
0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-07-14 21:58 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f48526b8d2ac53b9efdc378ac285493ddfb35cd8
commit r11-8749-gf48526b8d2ac53b9efdc378ac285493ddfb35cd8
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Tue Jun 22 17:21:32 2021 -0400
Adjust on_entry cache to indicate if the value was set properly.
* gimple-range-cache.cc (class ssa_block_ranges): Adjust prototype.
(sbr_vector::set_bb_range): Return true.
(class sbr_sparse_bitmap): Adjust.
(sbr_sparse_bitmap::set_bb_range): Return value.
(block_range_cache::set_bb_range): Return value.
(ranger_cache::propagate_cache): Use return value to print msg.
* gimple-range-cache.h (class block_range_cache): Adjust.
Diff:
---
gcc/gimple-range-cache.cc | 44 +++++++++++++++++++++++++-------------------
gcc/gimple-range-cache.h | 2 +-
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 068905d4774..610d4c50531 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -113,7 +113,7 @@ non_null_ref::process_name (tree name)
class ssa_block_ranges
{
public:
- virtual void set_bb_range (const basic_block bb, const irange &r) = 0;
+ virtual bool set_bb_range (const basic_block bb, const irange &r) = 0;
virtual bool get_bb_range (irange &r, const basic_block bb) = 0;
virtual bool bb_range_p (const basic_block bb) = 0;
@@ -146,7 +146,7 @@ class sbr_vector : public ssa_block_ranges
public:
sbr_vector (tree t, irange_allocator *allocator);
- virtual void set_bb_range (const basic_block bb, const irange &r) OVERRIDE;
+ virtual bool set_bb_range (const basic_block bb, const irange &r) OVERRIDE;
virtual bool get_bb_range (irange &r, const basic_block bb) OVERRIDE;
virtual bool bb_range_p (const basic_block bb) OVERRIDE;
protected:
@@ -177,7 +177,7 @@ sbr_vector::sbr_vector (tree t, irange_allocator *allocator)
// Set the range for block BB to be R.
-void
+bool
sbr_vector::set_bb_range (const basic_block bb, const irange &r)
{
irange *m;
@@ -189,6 +189,7 @@ sbr_vector::set_bb_range (const basic_block bb, const irange &r)
else
m = m_irange_allocator->allocate (r);
m_tab[bb->index] = m;
+ return true;
}
// Return the range associated with block BB in R. Return false if
@@ -233,7 +234,7 @@ class sbr_sparse_bitmap : public ssa_block_ranges
{
public:
sbr_sparse_bitmap (tree t, irange_allocator *allocator, bitmap_obstack *bm);
- virtual void set_bb_range (const basic_block bb, const irange &r) OVERRIDE;
+ virtual bool set_bb_range (const basic_block bb, const irange &r) OVERRIDE;
virtual bool get_bb_range (irange &r, const basic_block bb) OVERRIDE;
virtual bool bb_range_p (const basic_block bb) OVERRIDE;
private:
@@ -293,13 +294,13 @@ sbr_sparse_bitmap::bitmap_get_quad (const_bitmap head, int quad)
// Set the range on entry to basic block BB to R.
-void
+bool
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);
- return;
+ return true;
}
// Loop thru the values to see if R is already present.
@@ -309,11 +310,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);
- return;
+ return true;
}
// All values are taken, default to VARYING.
bitmap_set_quad (bitvec, bb->index, SBR_VARYING);
- return;
+ return false;
}
// Return the range associated with block BB in R. Return false if
@@ -368,7 +369,7 @@ block_range_cache::~block_range_cache ()
// Set the range for NAME on entry to block BB to R.
// If it has not been // accessed yet, allocate it first.
-void
+bool
block_range_cache::set_bb_range (tree name, const basic_block bb,
const irange &r)
{
@@ -394,7 +395,7 @@ block_range_cache::set_bb_range (tree name, const basic_block bb,
m_irange_allocator);
}
}
- m_ssa_ranges[v]->set_bb_range (bb, r);
+ return m_ssa_ranges[v]->set_bb_range (bb, r);
}
@@ -1029,13 +1030,18 @@ ranger_cache::propagate_cache (tree name)
// If the range on entry has changed, update it.
if (new_range != current_range)
{
+ bool ok_p = m_on_entry.set_bb_range (name, bb, new_range);
if (DEBUG_RANGE_CACHE)
{
- fprintf (dump_file, " Updating range to ");
- new_range.dump (dump_file);
+ if (!ok_p)
+ fprintf (dump_file, " Cache failure to store value.");
+ else
+ {
+ fprintf (dump_file, " Updating range to ");
+ new_range.dump (dump_file);
+ }
fprintf (dump_file, "\n Updating blocks :");
}
- m_on_entry.set_bb_range (name, bb, new_range);
// Mark each successor that has a range to re-check its range
FOR_EACH_EDGE (e, ei, bb->succs)
if (m_on_entry.bb_range_p (name, e->dest))
@@ -1048,12 +1054,12 @@ ranger_cache::propagate_cache (tree name)
fprintf (dump_file, "\n");
}
}
- if (DEBUG_RANGE_CACHE)
- {
- fprintf (dump_file, "DONE visiting blocks for ");
- print_generic_expr (dump_file, name, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "DONE visiting blocks for ");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
}
// Check to see if an update to the value for NAME in BB has any effect
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index 43e576a51f9..f82816f10c1 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -50,7 +50,7 @@ public:
block_range_cache ();
~block_range_cache ();
- void set_bb_range (tree name, const basic_block bb, const irange &r);
+ bool set_bb_range (tree name, const basic_block bb, const irange &r);
bool get_bb_range (irange &r, tree name, const basic_block bb);
bool bb_range_p (tree name, const basic_block bb);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-14 21:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 21:58 [gcc r11-8749] Adjust on_entry cache to indicate if the value was set properly Andrew Macleod
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).