git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123364
91177308-0d34-0410-b5e6-
96231b3b80d8
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
--- /dev/null
+; 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
--- /dev/null
+; This file is for use with unnamed-addr1-a.ll
+; RUN: true
+
+@foo = common unnamed_addr global i32 0, align 4
--- /dev/null
+; 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()
--- /dev/null
+; This file is for use with unnamed-addr2-a.ll
+; RUN: true
+
+define unnamed_addr i32 @foo() {
+entry:
+ ret i32 42
+}