Paul Brook wrote:
The new __builtin_unreachable() is meant to be placed directly after
an asm that never returns. I cannot think of any other valid uses for
gcc_unreachable and gcc_assert are obvious candidates.
For gcc_unreachable I agree. For gcc_assert the problem is that
is not a no-op, and it may introduce additional dereferences or
additional register pressure that offset any optimization possibilities
stemming from knowledge that "f && *f".
Besides, even in the second version there are two problems. First, the
builtin only works on RTL. Until RTL, it does not act as it
should---there is no optimization done on trees on
return f != NULL;
(should optimize to return 1). Second, once in RTL I'm not sure how it
behaves in cfglayout mode.