[LLVMdev] disable insertion of unreachables

Eli Friedman eli.friedman at gmail.com
Sun Sep 20 21:22:44 PDT 2009


On Sun, Sep 20, 2009 at 8:56 PM, Max Stonebraker
<max.stonebraker at gmail.com> wrote:
>> If there's sensible control flow after a function returns, don't mark
>> it or calls to it noreturn.
>
> How do I prevent llvm-gcc from labelling a particular function with the
> noreturn attribute so an unreachable is not inserted after a call to it?
> Does llvm-gcc keep a list of functions somewhere that it thinks do not
> return?

llvm-gcc knows all the C library functions that are noreturn.  Control
flow after one of those doesn't make sense; if you really want
llvm-gcc to avoid making assumptions about them, use -fno-builtin.

llvm-gcc can also tell if a function is noreturn if the implementation
of the function is in the same file; in that case, there's no easy way
to prevent the functions from getting appropriately marked.

llvm-gcc also marks functions marked with __attribute__((noreturn)) as
noreturn; the solution there is simply not to mark the relevant
functions.

-Eli



More information about the llvm-dev mailing list