Clear invariant bit for inferred ranges.

The range of an invariant SSA (no outgoing edge range anywhere) is not tracked.
If an inferred range is registered, remove the invariant flag.

	* gimple-range-cache.cc (ranger_cache::apply_inferred_ranges): If name
	was invaraint before, clear the invariant bit.
	* gimple-range-gori.cc (gori_map::set_range_invariant): Add a flag.
	* gimple-range-gori.h (gori_map::set_range_invariant): Adjust prototype.
This commit is contained in:
Andrew MacLeod 2022-06-16 12:44:33 -04:00
parent 5b1594dc2d
commit 6c849e2fab
3 changed files with 14 additions and 5 deletions

View File

@ -1474,7 +1474,12 @@ ranger_cache::apply_inferred_ranges (gimple *s)
if (!m_on_entry.get_bb_range (r, name, bb))
exit_range (r, name, bb, RFD_READ_ONLY);
if (r.intersect (infer.range (x)))
m_on_entry.set_bb_range (name, bb, r);
{
m_on_entry.set_bb_range (name, bb, r);
// If this range was invariant before, remove invariance.
if (!m_gori.has_edge_range_p (name))
m_gori.set_range_invariant (name, false);
}
}
}
}

View File

@ -499,12 +499,16 @@ gori_map::is_export_p (tree name, basic_block bb)
return bitmap_bit_p (exports (bb), SSA_NAME_VERSION (name));
}
// Clear the m_maybe_variant bit so ranges will not be tracked for NAME.
// Set or clear the m_maybe_variant bit to determine if ranges will be tracked
// for NAME. A clear bit means they will NOT be tracked.
void
gori_map::set_range_invariant (tree name)
gori_map::set_range_invariant (tree name, bool invariant)
{
bitmap_clear_bit (m_maybe_variant, SSA_NAME_VERSION (name));
if (invariant)
bitmap_clear_bit (m_maybe_variant, SSA_NAME_VERSION (name));
else
bitmap_set_bit (m_maybe_variant, SSA_NAME_VERSION (name));
}
// Return true if NAME is an import to block BB.

View File

@ -94,7 +94,7 @@ public:
bool is_import_p (tree name, basic_block bb);
bitmap exports (basic_block bb);
bitmap imports (basic_block bb);
void set_range_invariant (tree name);
void set_range_invariant (tree name, bool invariant = true);
void dump (FILE *f);
void dump (FILE *f, basic_block bb, bool verbose = true);