1 ; RUN: rm -rf %t && split-file %s %t
2 ; RUN: llvm-link %t/1.ll -S -o - | FileCheck %s --check-prefix=CHECK1
3 ;; The source doesn't have comdat.
4 ; RUN: llvm-link %t/2.ll -S -o - | FileCheck %s --check-prefix=CHECK2
6 ;; The leader is an alias.
7 ; RUN: llvm-link %t/3.ll %t/3-aux.ll -S -o - | FileCheck %s
8 ; RUN: llvm-link %t/3-aux.ll %t/3.ll -S -o - | FileCheck %s
12 @a = alias void (), ptr @f
13 define internal void @f() comdat($c) {
17 ; CHECK1-DAG: $c = comdat any
18 ; CHECK1-DAG: @a = alias void (), ptr @f
19 ; CHECK1-DAG: define internal void @f() comdat($c)
22 define linkonce_odr void @f2() comdat($f2) {
25 define void @f3() comdat($f2) {
29 ; CHECK1-DAG: $f2 = comdat largest
30 ; CHECK1-DAG: define linkonce_odr void @f2()
35 ; CHECK2: @c = global i32 0, comdat
36 @c = global i32 0, comdat
39 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
42 @foo = linkonce_odr unnamed_addr constant [1 x ptr] [ptr @bar], comdat($foo)
44 ; CHECK: @foo = alias ptr, getelementptr inbounds ([2 x ptr], ptr @some_name, i32 0, i32 1)
46 declare void @bar() unnamed_addr
49 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
53 @zed = external constant i8
54 @some_name = private unnamed_addr constant [2 x ptr] [ptr @zed, ptr @bar], comdat($foo)
55 @foo = alias ptr, getelementptr([2 x ptr], ptr @some_name, i32 0, i32 1)
57 declare void @bar() unnamed_addr