[LLVMdev] built-in longjmp and setjmp

Joerg Sonnenberger joerg at britannica.bec.de
Wed Apr 27 17:24:20 PDT 2011

On Wed, Apr 27, 2011 at 04:25:30PM -0700, Jim Grosbach wrote:
> On Apr 27, 2011, at 4:08 PM, Joerg Sonnenberger wrote:
> > On Wed, Apr 27, 2011 at 03:55:53PM -0700, Jim Grosbach wrote:
> >> The builtins are for internal compiler use in the context of SjLj
> >> exception handling. Any other use, including any direct calls of the
> >> builtins in user code, are a bad idea with no guaranteed behaviour.
> >> That they're exposed at all is, again, for historical purposes. Don't use them. 
> > 
> > Why is longjmp converted into calls to the builtin then?
> > See PR 8765.
> Hi Joerg,
> If I follow what's happing in PR8765 correctly, it's a bit different.
> setjmp/longjmp calls are never lowered to the builtin EH intrinsics.

Yes, this is not about using them for exception handling.

> Unfortunately, "builtin" is a bit of an overloaded term. :( Something
> else is recognizing the "setjmp" name as special and is doing something
> with it (e.g., SelectionDAGISel checks for it as well as a few other
> "returns twice" functions).

I suppose this is the normal common library name detection logic. Point
of my inquire in this context is whether the mapping to the builtin
gives anything over just applying the "returns twice" attribute.
Doing only the latter would not have issues with the external name


More information about the llvm-dev mailing list