[LLVMdev] llvm linking issue

Guo, Xiaoyi Xiaoyi.Guo at amd.com
Thu Nov 1 11:46:10 PDT 2012


Bug 14235 has been submitted.

Xiaoyi

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands
Sent: Thursday, November 01, 2012 12:11 AM
To: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] llvm linking issue

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
>

_______________________________________________
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