This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add new built-in: __builtin_unreachable()
- From: Paolo Bonzini <paolo dot bonzini at gmail dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, David Daney <ddaney at caviumnetworks dot com>, Ian Lance Taylor <iant at google dot com>
- Date: Tue, 09 Jun 2009 08:27:06 +0200
- Subject: Re: [PATCH] Add new built-in: __builtin_unreachable()
- References: <4A26C3EF.email@example.com> <firstname.lastname@example.org>
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.