llvm.org GIT mirror llvm / c2a94da
Keep unnamed_addr when linking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123364 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 9 years ago
5 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
351351 unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
352352 DestGV->copyAttributesFrom(SrcGV);
353353 DestGV->setAlignment(Alignment);
354 if (SrcGV->hasUnnamedAddr())
355 DestGV->setUnnamedAddr(true);
354356 }
355357
356358 /// GetLinkageResult - This analyzes the two global values and determines what
0 ; RUN: llvm-link %s %p/unnamed-addr1-b.ll -S -o - | FileCheck %s
1
2 @foo = external global i32
3
4 define i32 @bar() {
5 entry:
6 %tmp = load i32* @foo, align 4
7 ret i32 %tmp
8 }
9
10 ; CHECK: @foo = common unnamed_addr global i32 0, align 4
0 ; This file is for use with unnamed-addr1-a.ll
1 ; RUN: true
2
3 @foo = common unnamed_addr global i32 0, align 4
0 ; RUN: llvm-link %s %p/unnamed-addr2-b.ll -S -o - | FileCheck %s
1
2 define i32 @bar() {
3 entry:
4 %call = tail call i32 @foo()
5 ret i32 %call
6 }
7
8 declare i32 @foo()
9
10 ; CHECK: define unnamed_addr i32 @foo()
0 ; This file is for use with unnamed-addr2-a.ll
1 ; RUN: true
2
3 define unnamed_addr i32 @foo() {
4 entry:
5 ret i32 42
6 }