Add Ranger temporal cache
authorAndrew MacLeod <amacleod@redhat.com>
Wed, 4 Nov 2020 17:59:15 +0000 (12:59 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 4 Nov 2020 18:07:53 +0000 (13:07 -0500)
commite86fd6a17cdb26710d1f13c9a47a3878c76028f9
tree28e836b34524e1129f1ceb70527d301c8483fe53
parent9c1125c121423a9948fa39e71ef89ba4059a2fad
Add Ranger temporal cache

Add a timestamp to supplement the global range cache to detect when a value
may become stale.

gcc/
PR tree-optimization/97515
* gimple-range-cache.h (class ranger_cache): New prototypes plus
temporal cache pointer.
* gimple-range-cache.cc (struct range_timestamp): New.
(class temporal_cache): New.
(temporal_cache::temporal_cache): New.
(temporal_cache::~temporal_cache): New.
(temporal_cache::get_timestamp): New.
(temporal_cache::set_dependency): New.
(temporal_cache::temporal_value): New.
(temporal_cache::current_p): New.
(temporal_cache::set_timestamp): New.
(temporal_cache::set_always_current): New.
(ranger_cache::ranger_cache): Allocate the temporal cache.
(ranger_cache::~ranger_cache): Free temporal cache.
(ranger_cache::get_non_stale_global_range): New.
(ranger_cache::set_global_range): Add a timestamp.
(ranger_cache::register_dependency): New.  Add timestamp dependency.
* gimple-range.cc (gimple_ranger::range_of_range_op): Add operand
dependencies.
(gimple_ranger::range_of_phi): Ditto.
(gimple_ranger::range_of_stmt): Check if global range is stale, and
recalculate if so.
gcc/testsuite/
* gcc.dg/pr97515.c: Check listing for folding of entire function.
gcc/gimple-range-cache.cc
gcc/gimple-range-cache.h
gcc/gimple-range.cc
gcc/testsuite/gcc.dg/pr97515.c