[LLVMdev] "UNREACHABLE executed!" error?

Nick Lewycky nicholas at mxc.ca
Sun Aug 15 16:06:50 PDT 2010

OvermindDL1 wrote:
> On Sun, Aug 15, 2010 at 3:38 PM, Eric Christopher<echristo at apple.com>  wrote:
>> On Aug 15, 2010, at 2:34 PM, Nick Lewycky wrote:
>>> Anton Korobeynikov wrote:
>>>> Hello
>>>>> I just noticed that my union seems to look like an array....is that actually
>>>>> a union or do I have a problem somewhere?
>>>> Yes. Unions are pretty much broken and unimplemented. They can be
>>>> removed pretty soon (say, after 2.8)
>>> We've never released with unions. Could we remove them for the 2.8
>>> release instead of afterwards when they're part of our forever forwards
>>> compatible bitcode format?
>>> Similar to what we did to the vfcmp and ficmp instructions maybe?
>> I'm for it.  I thought I'd seen something to that effect anyhow.
> Could you not just keep the IRBuilder instructions for the union, but
> have it lower it to whatever the necessary IR code is?  Unions are
> nice as you do not need to worry about the size, else you have to
> figure out what size it needs to be if you handle it manually, and
> sometime that is exceedingly difficult before code generation time,
> causing a lot more code generation.

Unions are an entire new *type*. If it were merely new instructions that 
would certainly be feasible. The point of union is that it can express 
something you can't express in any other way, a type with a size of the 
max of a set of other types, even when you don't know those other sizes.

You can get equivalent behaviour in LLVM IR with the GEP trick[1] and 
alloca'ing the right about of space, but there's no way at all to make 
it match the API of a type.


[1] - 

More information about the llvm-dev mailing list