https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80265
--- Comment #36 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #35) > I just noticed that Jonathan has already written such a patch in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86590#c28 but didn't commit it > (maybe because is_constant_evaluated was not committed yet, or because it > was not sufficient to solve that PR). I think in the exact PR86590 case in the end __builtin_is_constant_evaluated() hasn't helped, but it can in other cases; without it, the __builtin_constant_p isn't folded at least in the most common case where the argument is not constant early enough, it isn't folded during/after early inlining, nor soon after IPA inlining, it is just fab pass. While with __builtin_is_constant_evaluated(), it can be optimized either before early inlining (if it is used directly in the function), or soon after early inlining (otherwise).