[LLVMdev] StructTypes into one

Duncan Sands baldrick at free.fr
Fri May 4 09:54:47 PDT 2012


Hi Neo,

> I have such problem with linking represented files....  llvm-link 1.bc 2.bc -o 3.bc

using the 3.1 release candidate I don't see anything odd.  In 3.bc there are
only two new funky type names:

%"struct.std::pair.8" = type { %"class.std::basic_string", i32 }
%"struct.std::_Rb_tree_node.10" = type { %"struct.std::_Rb_tree_node_base", 
%"struct.std::pair.8" }

All the other type names with a number appended already existed in 1.bc or 2.bc.

So why did these two types have a number appended?  It's pretty clear.  Consider

%"struct.std::pair.8" = type { %"class.std::basic_string", i32 }

There's another std::pair type in the module:

%"struct.std::pair" = type { i32, %"class.std::basic_string" }

These are not the same (field order inverted), thus these types can't get the
same name.

This also explains the other type: there is

%"struct.std::_Rb_tree_node" = type { %"struct.std::_Rb_tree_node_base", 
%"struct.std::pair" }

as well as

%"struct.std::_Rb_tree_node.10" = type { %"struct.std::_Rb_tree_node_base", 
%"struct.std::pair.8" }

These are different because the second fields are different as explained above.

Ciao, Duncan.



More information about the llvm-dev mailing list