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

--- Comment #17 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #16)
> (In reply to Marc Glisse from comment #13)
> > it seems better than abusing __builtin_constant_p, which is getting
> > contradictory requirements from its various uses:
> > - constexpr (forces very early lowering)
> 
> I'm not sure what you mean here; constexpr specifically delays lowering
> within a constexpr function until we're actually trying to evaluate to a
> constant value.

Evaluating a constexpr function forces the front-end to evaluate
__builtin_constant_p. That's very early compared to usual __builtin_constant_p
lowering during gimple optimizations. However, now that I think about it, I
can't remember why I thought this would be an issue. constexpr evaluation only
happens when required, not as an optimization, and when it happens the whole
function gets evaluated at compile-time, so I can't think of when we would miss
an optimization this way...

Reply via email to