xref: /llvm-project/llvm/test/tools/llvm-extract/extract-linkonce.ll (revision a273c40820f78d8b08e411897eee84dbda983488)
1; RUN: llvm-extract -func foo -S < %s | FileCheck %s
2; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s
3
4; Test that linkonce definitions are mapped to weak so that they are not
5; dropped.
6
7; CHECK:      @bar = external global i32
8; CHECK:      define weak ptr @foo() {
9; CHECK-NEXT:  ret ptr @bar
10; CHECK-NEXT: }
11
12; DELETE: @bar = weak global i32 42
13; DELETE: declare ptr @foo()
14
15@bar = linkonce global i32 42
16
17define linkonce ptr @foo() {
18  ret ptr @bar
19}
20
21define void @g() {
22  call ptr @foo()
23  ret void
24}
25