xref: /aosp_15_r20/external/llvm/test/Other/extract.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-extract -func foo -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as < %s > %t
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-extract -func foo -S %t | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llvm-extract -delete -func foo -S %t | FileCheck --check-prefix=DELETE %s
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; llvm-extract uses lazy bitcode loading, so make sure it correctly reads
8*9880d681SAndroid Build Coastguard Worker; from bitcode files in addition to assembly files.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; CHECK: define hidden void @foo() comdat($x) {
11*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
12*9880d681SAndroid Build Coastguard Worker; CHECK: }
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; The private linkage for foo() should be changed to external linkage and
15*9880d681SAndroid Build Coastguard Worker; hidden visibility added.
16*9880d681SAndroid Build Coastguard Worker; DELETE: declare hidden void @foo()
17*9880d681SAndroid Build Coastguard Worker; DELETE-NOT: comdat
18*9880d681SAndroid Build Coastguard Worker; DELETE: define void @bar() {
19*9880d681SAndroid Build Coastguard Worker; DELETE:   call void @foo()
20*9880d681SAndroid Build Coastguard Worker; DELETE:   ret void
21*9880d681SAndroid Build Coastguard Worker; DELETE: }
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker$x = comdat any
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdefine private void @foo() comdat($x) {
26*9880d681SAndroid Build Coastguard Worker  ret void
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Workerdefine void @bar() {
29*9880d681SAndroid Build Coastguard Worker  call void @foo()
30*9880d681SAndroid Build Coastguard Worker  ret void
31*9880d681SAndroid Build Coastguard Worker}
32