xref: /aosp_15_r20/external/llvm/test/LTO/X86/cfi_endproc.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as < %s >%t1
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -o %t2 %t1
3*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t2 | FileCheck %s -check-prefix=NOEXPORT
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -o %t3 -exported-symbol=main %t1
5*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t3 | FileCheck %s -check-prefix=EXPORT
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
8*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workermodule asm ".text"
11*9880d681SAndroid Build Coastguard Workermodule asm ".align 16, 0x90"
12*9880d681SAndroid Build Coastguard Workermodule asm ".type PR14512, @function"
13*9880d681SAndroid Build Coastguard Workermodule asm "PR14512:.cfi_startproc"
14*9880d681SAndroid Build Coastguard Workermodule asm "ret"
15*9880d681SAndroid Build Coastguard Workermodule asm ".cfi_endproc"
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdeclare void @PR14512()
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; Without -exported-symbol, main should be eliminated by LTO.
20*9880d681SAndroid Build Coastguard Worker; With -exported-symbol=main, main should be preserved by LTO.
21*9880d681SAndroid Build Coastguard Workerdefine i32 @main(i32 %argc, i8** %argv) {
22*9880d681SAndroid Build Coastguard Worker; NOEXPORT-NOT: main
23*9880d681SAndroid Build Coastguard Worker; EXPORT: main
24*9880d681SAndroid Build Coastguard Worker  call void @PR14512()
25*9880d681SAndroid Build Coastguard Worker  ret i32 0
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -o %t -dso-symbol=zed1 -dso-symbol=zed2 %t1 -O0
29*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t | FileCheck %s -check-prefix=ZED1_AND_ZED2
30*9880d681SAndroid Build Coastguard Worker; ZED1_AND_ZED2: V zed1
31*9880d681SAndroid Build Coastguard Worker@zed1 = linkonce_odr global i32 42
32*9880d681SAndroid Build Coastguard Workerdefine i32* @get_zed1() {
33*9880d681SAndroid Build Coastguard Worker  ret i32* @zed1
34*9880d681SAndroid Build Coastguard Worker}
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; ZED1_AND_ZED2: r zed2
37*9880d681SAndroid Build Coastguard Worker@zed2 = linkonce_odr unnamed_addr constant i32 42
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Workerdefine i32 @useZed2() {
40*9880d681SAndroid Build Coastguard Worker  %x = load i32, i32* @zed2
41*9880d681SAndroid Build Coastguard Worker  ret i32 %x
42*9880d681SAndroid Build Coastguard Worker}
43