https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586
--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> --- Another possible compromise is to add 'bool for_warnings = false' argument to maybe_constant_value, store it along with the reduced tree in cv_cache (perhaps even by setting a flag on the tree itself?), and then when retrieving from cv_cache when !for_warnings, but the retrieved tree has the flag set, throw it away and recompute. That should be a fairly simple change that keeps the current speed when the warnings are disabled or main code generation needs the reduced tree before some of the warnings do.