On 10/8/25 9:55 AM, Jakub Jelinek wrote:
On Tue, Oct 07, 2025 at 10:50:50PM +0100, Jason Merrill wrote:
Tested x86_64-pc-linux-gnu. Jakub, does this make sense to you?
It makes sense, I'm just worried about if consteval having high cost
(mce_unknown evaluations being non-constant, so either then repeated
as mce_true or failing to be optimized if it is just an optimization).
I was thinking about something like (untested) where in your
patch then you'd set IF_STMT_CONSTEVAL_INTERNAL_P flag instead of
IF_STMT_CONSTEVAL_P (and perhaps put the internal into the name
of the fn too).
But up to you...
I think it isn't worth bothering with that for this corner case; it's
only needed in very rare cases.
But this is a general issue with if consteval that affects a lot of
user/library code, and solving it more generally might be useful.
Perhaps with an attribute on the "if consteval" statement?
Jason