Ranger optimization cache uses two timestamps
Ranger optimization cache distinguishes between value storage and calculation times for better cache invalidation.
The Ranger optimization pass’s caching mechanism has been updated to use two distinct timestamps: one for when a value was last stored and another for when it was last calculated. This allows the compiler to differentiate between a value that was recalculated but unchanged, and one that truly changed. This finer-grained tracking improves the cache’s accuracy and efficiency by preventing unnecessary recalculations when a value’s computed result remains the same.
In Details
The temporal_cache in gcc/gimple-range-cache.cc used a single timestamp for cache invalidation. This commit splits it into stored and calculated timestamps, allowing for more precise cache management. This helps resolve PR tree-optimization/125758 by improving the ranger's ability to track value staleness.
- Ranger
- A GCC optimization pass that analyzes and transforms code based on value ranges, aiming to simplify expressions and improve performance.
- Cache invalidation
- The process of marking cached data as invalid, forcing it to be re-fetched or recalculated from the original source. In compilers, this is crucial for ensuring that optimizations are based on up-to-date information.
- gimple-range-cache.cc
- The GCC source file implementing the caching mechanism used by the Ranger optimization pass.