StructTypes into one

Is it possible to merge StructTypes with different names like:

%"class.std::allocator.4" = type { i8 }
%"class.__gnu_cxx::new_allocator.5" = type { i8 }
%"class.std::allocator.0" = type { i8 }
%"class.__gnu_cxx::new_allocator.1" = type { i8 }
%"class.std::allocator.0.6" = type { i8 }

merge into

%"class.__gnu_cxx::new_allocator" = type { i8 }
%"class.std::allocator" = type { i8 }

in module?

Thanks!

Yours sincerely,
Kadysev Mikhail

Hi Михаил,

Is it possible to merge StructTypes with different names like:

%"class.std::allocator.4" = type { i8 }
%"class.__gnu_cxx::new_allocator.5" = type { i8 }
%"class.std::allocator.0" = type { i8 }
%"class.__gnu_cxx::new_allocator.1" = type { i8 }
%"class.std::allocator.0.6" = type { i8 }

merge into

%"class.__gnu_cxx::new_allocator" = type { i8 }
%"class.std::allocator" = type { i8 }

in module?

it this point it is too late. The question is: why did the linker not merge
them when doing the linking? So can you please provide a complete example
of modules before linking, which when linked result in this.

Thanks, Duncan.

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

2012/5/4 Duncan Sands <baldrick@free.fr>

Hi Михаил,

Is it possible to merge StructTypes with different names like:

%“class.std::allocator.4” = type { i8 }
%“class.__gnu_cxx::new_allocator.5” = type { i8 }
%“class.std::allocator.0” = type { i8 }
%“class.__gnu_cxx::new_allocator.1” = type { i8 }
%“class.std::allocator.0.6” = type { i8 }

merge into

%“class.__gnu_cxx::new_allocator” = type { i8 }
%“class.std::allocator” = type { i8 }

in module?

it this point it is too late. The question is: why did the linker not merge
them when doing the linking? So can you please provide a complete example
of modules before linking, which when linked result in this.

Thanks, Duncan.


LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Kadysev Mikhail

1.bc (28.3 KB)

2.bc (28.2 KB)

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.