[LLVMdev] llvm linking issue
Duncan Sands
baldrick at free.fr
Thu Nov 1 00:10:49 PDT 2012
Hi Xiaoyi, this looks like a bug to me - please file a bug report.
Ciao, Duncan.
On 01/11/12 04:35, Guo, Xiaoyi wrote:
> I have three modules:
> -----------------------------------------------------------------
> s1.ll:
>
> %0 = type <{ i32, i32 }>
>
> define void @s1(%0* byval %myStruct) nounwind {
> return:
> ret void
> }
> -----------------------------------------------------------------
> s2.ll:
>
> %0 = type <{ i32, i32 }>
>
> define void @s2(%0* byval %myStruct) nounwind {
> return:
> ret void
> }
> -----------------------------------------------------------------
> s3.ll:
> %0 = type <{ i32, i32 }>
>
> declare void @s1(%0* byval) nounwind readonly
> declare void @s2(%0* byval) nounwind readonly
>
> define void @s3(%0* byval %myStruct) nounwind {
> call void @s1(%0* %myStruct) nounwind
> call void @s2(%0* %myStruct) nounwind
> ret void
> }
> -----------------------------------------------------------------
> If they are linked in one order:
> $ llvm-link -o s.bc s1.ll s2.ll s3.ll
> The linked IR is:
>
> %0 = type <{ i32, i32 }>
> %1 = type <{ i32, i32 }>
>
> define void @s1(%0* byval %myStruct) nounwind {
> return:
> ret void
> }
>
> define void @s2(%1* byval %myStruct) nounwind {
> return:
> ret void
> }
>
> define void @s3(%0* byval %myStruct) nounwind {
> call void @s1(%0* %myStruct) nounwind
> call void bitcast (void (%1*)* @s2 to void (%0*)*)(%0* %myStruct) nounwind
> ret void
> }
>
> -----------------------------------------------------------------
> If they are linked in a different order:
> $ llvm-link -o s.bc s3.ll s1.ll s2.ll
> The linked IR is:
>
> %0 = type <{ i32, i32 }>
>
> define void @s3(%0* byval %myStruct) nounwind {
> call void @s1(%0* %myStruct) nounwind
> call void @s2(%0* %myStruct) nounwind
> ret void
> }
>
> define void @s1(%0* byval %myStruct) nounwind {
> return:
> ret void
> }
>
> define void @s2(%0* byval %myStruct) nounwind {
> return:
> ret void
> }
>
> Shouldn't the second linked IR be generated regardless of the order the modules are linked in?
>
> Thanks,
> Xiaoyi
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list