[LLVMdev] inefficiencies in ConstantUniqueMap ?

Chris Lattner clattner at apple.com
Thu Jun 30 13:21:24 PDT 2011


On Jun 30, 2011, at 6:07 AM, Duncan Sands wrote:

>> - they use name equivalence instead of structural equivalence.
>> - you can create them without any fields, and then add the fields
>> later when the struct is complete.
> 
> I find this distinction between structs with names and structs without
> names strange.  Why is a name relevant to anything?  If you can add fields
> to a struct with a name why not to a struct without a name?

The issue is that we have two cases here:

1. anonymous structs which are just used for aggregation, but that are uniqued by-structure.  This is mostly useful for simple things like complex numbers, which you want the type to expand inline in .ll files etc.

2. named structs which are uniqued by (obviously their name).

The subcase of #2 is that we want a "named struct without a name" because we want the -strip pass to still be useful.  Because there is a semantic difference between named and unnamed types, I chose to call them "anonymous" structs, which don't have an identity, and "named" types whose name is allowed to be empty.

I plan to rename StructType::get to StructType::getAnon after the branch lands.

-Chris



More information about the llvm-dev mailing list