[LLVMdev] [LLVM, llvm-link] Opaque types.

Chris Lattner clattner at apple.com
Tue Dec 20 13:42:27 PST 2011

On Dec 20, 2011, at 1:05 PM, Stepan Dyatkovskiy wrote:

> OK. So if we have two modules with the same function name. This functions may not be isomorphic. 
> For example, we can link this files, but the function types are not isomorphic:
> ; 1.ll
> %T1 = type opaque
> declare i32 @foo(%T1*)
> ; 2.ll
> define i32 @foo(i32* %v) {...something...}
> But at the same time we should not map next two functions (PR11627):
> ; 3.ll
> declare i32 @foo(i16* %v)
> ; 4.ll
> define i32 @foo(i32* %b) {...something...}
> If I right, with that. How it is better to fix that? I propose to create some method canMapFunctions that will very similar to areTypesIsomorphic except the case I described in 1.ll and 2.ll. Is it fine?

The linker will force the functions together in both cases.  This doesn't have anything to do with areTypesIsomorphic though: it inserts bitcasts of the functions themselves (e.g. turning direct calls into indirect calls through a cast) to make this happen.


More information about the llvm-dev mailing list