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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> (In reply to Richard Biener from comment #2)
> > what?!  Ick.  It definitely shouldn't re-fold anything but only scrap caches
> > _at most_.
> 
> So it does
> 
>   // Only update if it already had a value.
>   if (m_cache.get_global_range (r, lhs))
>     {
>       // Re-calculate a new value using just cache values.
>       Value_Range tmp (TREE_TYPE (lhs));
>       fold_using_range f;
>       fur_stmt src (s, &m_cache);
>       f.fold_stmt (tmp, s, src, lhs);
> 
>       // Combine the new value with the old value to check for a change.
>       if (r.intersect (tmp))
>         {
>           if (dump_file && (dump_flags & TDF_DETAILS))
>             {
>               print_generic_expr (dump_file, lhs, TDF_SLIM);
>               fprintf (dump_file, " : global value re-evaluated to ");
>               r.dump (dump_file);
>               fputc ('\n', dump_file);
>             }
>           m_cache.set_global_range (lhs, r);
> 
> WTF?  If a pass invalidates a range it needs to properly do this itself.
> But update_stmt itself _never_ should alter range info.

At least the testcase that was added with it still passes when I remove
the call to get_range_query (fn)->update_stmt

Reply via email to