[LLVMdev] IR type safety
Devang Patel
dpatel at apple.com
Tue Sep 21 09:48:30 PDT 2010
On Sep 21, 2010, at 9:26 AM, Renato Golin wrote:
> But, when declaring two types that happen to (supposedly) have the
> same layout, LLVM ignores the second type and use the first's name
> instead.
>
> In one module, it doesn't matter, but once you join different modules
> with, possibly, different data layouts, the data types are not the
> same any more.
Try linking following two modules using llvm-ld and see what happens.
--- x.ll ---
%struct.x = type { i32, i32 }
%struct.y = type { i32, i32 }
@p = common global %struct.x zeroinitializer, align 4
@p2 = common global %struct.x zeroinitializer, align 4
---
--- y.ll ---
%struct.x = type { i32, i32, i32 }
@p3 = common global %struct.x zeroinitializer, align 4
---
In the combined llvm IR, @p3 and @p won't match as expected.
-
Devang
More information about the llvm-dev
mailing list