xref: /aosp_15_r20/external/llvm/test/Linker/comdat-rm-dst.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-link -S -o %t %s %p/Inputs/comdat-rm-dst.ll
2*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s < %t
3*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=RM %s < %t
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
6*9880d681SAndroid Build Coastguard Workertarget triple = "i686-pc-windows-msvc"
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker$foo = comdat largest
9*9880d681SAndroid Build Coastguard Worker@foo = global i32 42, comdat
10*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: @foo = global i64 43, comdat
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; RM-NOT: @alias =
13*9880d681SAndroid Build Coastguard Worker@alias = alias i32, i32* @foo
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker; We should arguably reject an out of comdat reference to int_alias. Given that
16*9880d681SAndroid Build Coastguard Worker; the verifier accepts it, test that we at least produce an output that passes
17*9880d681SAndroid Build Coastguard Worker; the verifier.
18*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: @int_alias = external global i32
19*9880d681SAndroid Build Coastguard Worker@int_alias = internal alias i32, i32* @foo
20*9880d681SAndroid Build Coastguard Worker@bar = global i32* @int_alias
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker@func_alias = alias void (), void ()* @func
23*9880d681SAndroid Build Coastguard Worker@zed = global void()* @func_alias
24*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: @zed = global void ()* @func_alias
25*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: declare void @func_alias()
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; RM-NOT: @func()
28*9880d681SAndroid Build Coastguard Workerdefine void @func() comdat($foo) {
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; RM-NOT: var
33*9880d681SAndroid Build Coastguard Worker@var = global i32 42, comdat($foo)
34