aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.cc
AgeCommit message (Collapse)AuthorFilesLines
2020-12-10Reduce memory requirements for rangerAndrew MacLeod1-3/+10
Calculate block exit info upfront, and then any SSA_NAME which is never used in an outgoing range calculation is a pure global and can bypass the on-entry cache. PR tree-optimization/98174 * gimple-range-cache.cc (ranger_cache::ssa_range_in_bb): Only push poor values to be examined if it isn't a pure global. (ranger_cache::block_range): Don't process pure globals. (ranger_cache::fill_block_cache): Adjust has_edge_range call. * gimple-range-gori.cc (gori_map::all_outgoing): New bitmap. (gori_map::gori_map): Allocate all_outgoing. (gori_map::is_export_p): No specified BB returns global context. (gori_map::calculate_gori): Accumulate each block into global. (gori_compute::gori_compute): Preprocess each block for exports. (gori_compute::has_edge_range_p): No edge returns global context. * gimple-range-gori.h (has_edge_range_p): Provide default parameter.
2020-11-04Add Ranger temporal cacheAndrew MacLeod1-0/+174
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.
2020-11-03More Ranger cache tweaksAndrew MacLeod1-41/+73
This patch splits the individual value propagation out from fill_block_cache, and calls it from set_global_value when the global value is updated. This ensures the "current" global value is reflected in the on-entry cache. * gimple-range-cache.cc (ssa_global_cache::get_global_range): Return true if there was a previous range set. (ranger_cache::ranger_cache): Take a gimple_ranger parameter. (ranger_cache::set_global_range): Propagate the value if updating. (ranger_cache::propagate_cache): Renamed from iterative_cache_update. (ranger_cache::propagate_updated_value): New. Split from: (ranger_cache::fill_block_cache): Split out value propagator. * gimple-range-cache.h (ssa_global_cache): Update prototypes. (ranger_cache): Update prototypes.
2020-11-03Tweaks to ranger cacheAndrew MacLeod1-7/+69
Add some bounds checking to ssa_block_ranges, and privatize the ranges block cache and global cache, adding API points for accessing them. * gimple-range-cache.h (block_range_cache): Add new entry point. (ranger_cache): Privatize global abnd block cache members. * gimple-range-cache.cc (ssa_block_ranges::set_bb_range): Add bounds check. (ssa_block_ranges::set_bb_varying): Ditto. (ssa_block_ranges::get_bb_range): Ditto. (ssa_block_ranges::bb_range_p): Ditto. (block_range_cache::get_block_ranges): Fix formatting. (block_range_cache::query_block_ranges): New. (block_range_cache::get_bb_range): Use Query_block_ranges. (block_range_cache::bb_range_p): Ditto. (ranger_cache::dump): New. (ranger_cache::get_global_range): New. (ranger_cache::set_global_range): New. * gimple-range.cc (gimple_ranger::range_of_expr): Use new API. (gimple_ranger::range_of_stmt): Ditto. (gimple_ranger::export_global_ranges): Ditto. (gimple_ranger::dump): Ditto.
2020-10-28Call infer_non_null() directly when checking for non-null.Andrew MacLeod1-8/+4
Simply call infer_non_null directly and avoid uneccessary checks of the statement being modified. gcc/ PR tree-optimization/97609 * gimple-range-cache.cc (non_null_ref::process_name): Call infer_nonnull_range directly instead of infer_value_range. gcc/testsuite/ * g++.dg/pr97609.C: New.
2020-10-06Ranger classes.Andrew MacLeod1-0/+877
Add the 8 ranger files and the Makefile changes to build it. 2020-10-06 Andrew MacLeod <amacleod@redhat.com> * Makefile.in (OBJS): Add gimple-range*.o. * gimple-range.h: New file. * gimple-range.cc: New file. * gimple-range-cache.h: New file. * gimple-range-cache.cc: New file. * gimple-range-edge.h: New file. * gimple-range-edge.cc: New file. * gimple-range-gori.h: New file. * gimple-range-gori.cc: New file.