https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97909

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
This functionality was added with fc4076752067fb400b43adbd629081df658da246

Commentary here
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583216.html

All one needs is an active ranger via the enable_ranger() API.
*All* queries made from within folding are READ_ONLY.. ie, no new information
is ever created.  

So for accurate results, you need to query the ranges of any operands before
invoking fold to make sure the caches and information are up to date.

Then ::fold_stmt needs to be invoked via ranger->fold_stmt() instead which
provides a hook for the context required.

Any invocation of folding not done thru this interface will revert to whatever
ranger knows about global ranges.

IF we wish to utilize this via different API points, we can add them.  

Ultimately, we can try to get tighter integration of context with folding.

Reply via email to