parent
f41bdd7c24
commit
9ebe8ce68c
|
@ -352,6 +352,8 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
|
|||
unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
|
||||
DestGV->copyAttributesFrom(SrcGV);
|
||||
DestGV->setAlignment(Alignment);
|
||||
if (SrcGV->hasUnnamedAddr())
|
||||
DestGV->setUnnamedAddr(true);
|
||||
}
|
||||
|
||||
/// GetLinkageResult - This analyzes the two global values and determines what
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
; RUN: llvm-link %s %p/unnamed-addr1-b.ll -S -o - | FileCheck %s
|
||||
|
||||
@foo = external global i32
|
||||
|
||||
define i32 @bar() {
|
||||
entry:
|
||||
%tmp = load i32* @foo, align 4
|
||||
ret i32 %tmp
|
||||
}
|
||||
|
||||
; CHECK: @foo = common unnamed_addr global i32 0, align 4
|
|
@ -0,0 +1,4 @@
|
|||
; This file is for use with unnamed-addr1-a.ll
|
||||
; RUN: true
|
||||
|
||||
@foo = common unnamed_addr global i32 0, align 4
|
|
@ -0,0 +1,11 @@
|
|||
; RUN: llvm-link %s %p/unnamed-addr2-b.ll -S -o - | FileCheck %s
|
||||
|
||||
define i32 @bar() {
|
||||
entry:
|
||||
%call = tail call i32 @foo()
|
||||
ret i32 %call
|
||||
}
|
||||
|
||||
declare i32 @foo()
|
||||
|
||||
; CHECK: define unnamed_addr i32 @foo()
|
|
@ -0,0 +1,7 @@
|
|||
; This file is for use with unnamed-addr2-a.ll
|
||||
; RUN: true
|
||||
|
||||
define unnamed_addr i32 @foo() {
|
||||
entry:
|
||||
ret i32 42
|
||||
}
|
Loading…
Reference in New Issue