llvm.org GIT mirror llvm / f907a26
Change the .ll syntax for comdats and add a syntactic sugar. In order to make comdats always explicit in the IR, we decided to make the syntax a bit more compact for the case of a GlobalObject in a comdat with the same name. Just dropping the $name causes problems for @foo = globabl i32 0, comdat $bar = comdat ... and declare void @foo() comdat $bar = comdat ... So the syntax is changed to @g1 = globabl i32 0, comdat($c1) @g2 = globabl i32 0, comdat and declare void @foo() comdat($c1) declare void @foo() comdat git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225302 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
40 changed file(s) with 153 addition(s) and 115 deletion(s). Raw diff Collapse all Expand all
595595 [@ =] [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
596596 [unnamed_addr] [AddrSpace] [ExternallyInitialized]
597597 []
598 [, section "name"] [, align ]
598 [, section "name"] [, comdat [($name)]]
599 [, align ]
599600
600601 For example, the following defines a global in a numbered address space
601602 with an initializer, section, and alignment:
680681 define [linkage] [visibility] [DLLStorageClass]
681682 [cconv] [ret attrs]
682683 @ ([argument list])
683 [unnamed_addr] [fn Attrs] [section "name"] [comdat $]
684 [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
684685 [align N] [gc] [prefix Constant] [prologue Constant] { ... }
685686
686687 The argument list is a comma seperated sequence of arguments where each
774775 .. code-block:: llvm
775776
776777 $foo = comdat largest
777 @foo = global i32 2, comdat $foo
778
779 define void @bar() comdat $foo {
778 @foo = global i32 2, comdat($foo)
779
780 define void @bar() comdat($foo) {
780781 ret void
781782 }
783
784 As a syntactic sugar the ``$name`` can be omitted if the name is the same as
785 the global name:
786
787 .. code-block:: llvm
788
789 $foo = comdat any
790 @foo = global i32 2, comdat
791
782792
783793 In a COFF object file, this will create a COMDAT section with selection kind
784794 ``IMAGE_COMDAT_SELECT_LARGEST`` containing the contents of the ``@foo`` symbol
802812
803813 $foo = comdat any
804814 $bar = comdat any
805 @g1 = global i32 42, section "sec", comdat $foo
806 @g2 = global i32 42, section "sec", comdat $bar
815 @g1 = global i32 42, section "sec", comdat($foo)
816 @g2 = global i32 42, section "sec", comdat($bar)
807817
808818 From the object file perspective, this requires the creation of two sections
809819 with the same name. This is necessary because both globals belong to different
849849 GV->setAlignment(Alignment);
850850 } else {
851851 Comdat *C;
852 if (parseOptionalComdat(C))
852 if (parseOptionalComdat(Name, C))
853853 return true;
854854 if (C)
855855 GV->setComdat(C);
28982898 ParseGlobalValue(Ty, V);
28992899 }
29002900
2901 bool LLParser::parseOptionalComdat(Comdat *&C) {
2901 bool LLParser::parseOptionalComdat(StringRef GlobalName, Comdat *&C) {
29022902 C = nullptr;
2903
2904 LocTy KwLoc = Lex.getLoc();
29032905 if (!EatIfPresent(lltok::kw_comdat))
29042906 return false;
2905 if (Lex.getKind() != lltok::ComdatVar)
2906 return TokError("expected comdat variable");
2907 LocTy Loc = Lex.getLoc();
2908 StringRef Name = Lex.getStrVal();
2909 C = getComdat(Name, Loc);
2910 Lex.Lex();
2907
2908 if (EatIfPresent(lltok::lparen)) {
2909 if (Lex.getKind() != lltok::ComdatVar)
2910 return TokError("expected comdat variable");
2911 C = getComdat(Lex.getStrVal(), Lex.getLoc());
2912 Lex.Lex();
2913 if (ParseToken(lltok::rparen, "expected ')' after comdat var"))
2914 return true;
2915 } else {
2916 if (GlobalName.empty())
2917 return TokError("comdat cannot be unnamed");
2918 C = getComdat(GlobalName, KwLoc);
2919 }
2920
29112921 return false;
29122922 }
29132923
32613271 BuiltinLoc) ||
32623272 (EatIfPresent(lltok::kw_section) &&
32633273 ParseStringConstant(Section)) ||
3264 parseOptionalComdat(C) ||
3274 parseOptionalComdat(FunctionName, C) ||
32653275 ParseOptionalAlignment(Alignment) ||
32663276 (EatIfPresent(lltok::kw_gc) &&
32673277 ParseStringConstant(GC)) ||
384384 bool ParseGlobalValue(Type *Ty, Constant *&V);
385385 bool ParseGlobalTypeAndValue(Constant *&V);
386386 bool ParseGlobalValueVector(SmallVectorImpl &Elts);
387 bool parseOptionalComdat(Comdat *&C);
387 bool parseOptionalComdat(StringRef GlobalName, Comdat *&C);
388388 bool ParseMetadataAsValue(Value *&V, PerFunctionState &PFS);
389389 bool ParseValueAsMetadata(Metadata *&MD, PerFunctionState *PFS);
390390 bool ParseMetadata(Metadata *&MD, PerFunctionState *PFS);
16821682 }
16831683 }
16841684
1685 static void maybePrintComdat(formatted_raw_ostream &Out,
1686 const GlobalObject &GO) {
1687 const Comdat *C = GO.getComdat();
1688 if (!C)
1689 return;
1690
1691 if (isa(GO))
1692 Out << ',';
1693 Out << " comdat";
1694
1695 if (GO.getName() == C->getName())
1696 return;
1697
1698 Out << '(';
1699 PrintLLVMName(Out, C->getName(), ComdatPrefix);
1700 Out << ')';
1701 }
1702
16851703 void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
16861704 if (GV->isMaterializable())
16871705 Out << "; Materializable\n";
17151733 PrintEscapedString(GV->getSection(), Out);
17161734 Out << '"';
17171735 }
1718 if (GV->hasComdat()) {
1719 Out << ", comdat ";
1720 PrintLLVMName(Out, GV->getComdat()->getName(), ComdatPrefix);
1721 }
1736 maybePrintComdat(Out, *GV);
17221737 if (GV->getAlignment())
17231738 Out << ", align " << GV->getAlignment();
17241739
18991914 PrintEscapedString(F->getSection(), Out);
19001915 Out << '"';
19011916 }
1902 if (F->hasComdat()) {
1903 Out << " comdat ";
1904 PrintLLVMName(Out, F->getComdat()->getName(), ComdatPrefix);
1905 }
1917 maybePrintComdat(Out, *F);
19061918 if (F->getAlignment())
19071919 Out << " align " << F->getAlignment();
19081920 if (F->hasGC())
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
11
2 @v = global i32 0, comdat $v
2 @v = global i32 0, comdat($v)
33 ; CHECK: use of undefined comdat '$v'
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
1 ; CHECK: comdat cannot be unnamed
2
3 define void @0() comdat {
4 ret void
5 }
0 ; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck %s
11
22 $f1 = comdat any
3 @v1 = global i32 0, comdat $f1
4 define void @f1() comdat $f1 {
3 @v1 = global i32 0, comdat($f1)
4 define void @f1() comdat($f1) {
55 ret void
66 }
77
88 $f2 = comdat exactmatch
9 @v2 = global i32 0, comdat $f2
10 define void @f2() comdat $f2 {
9 @v2 = global i32 0, comdat($f2)
10 define void @f2() comdat($f2) {
1111 ret void
1212 }
1313
1414 $f3 = comdat largest
15 @v3 = global i32 0, comdat $f3
16 define void @f3() comdat $f3 {
15 @v3 = global i32 0, comdat($f3)
16 define void @f3() comdat($f3) {
1717 ret void
1818 }
1919
2020 $f4 = comdat noduplicates
21 @v4 = global i32 0, comdat $f4
22 define void @f4() comdat $f4 {
21 @v4 = global i32 0, comdat($f4)
22 define void @f4() comdat($f4) {
2323 ret void
2424 }
2525
2626 $f5 = comdat samesize
27 @v5 = global i32 0, comdat $f5
28 define void @f5() comdat $f5 {
27 @v5 = global i32 0, comdat($f5)
28 define void @f5() comdat($f5) {
2929 ret void
3030 }
3131
3232 $f6 = comdat samesize
33 @v6 = global i32 0, comdat $f6
34 @f6 = global i32 0, comdat $f6
33 @v6 = global i32 0, comdat($f6)
34 @f6 = global i32 0, comdat($f6)
3535
3636 $"\01@f7@0" = comdat any
37 define x86_fastcallcc void @"\01@v7@0"() comdat $"\01@f7@0" {
37 define x86_fastcallcc void @"\01@v7@0"() comdat($"\01@f7@0") {
3838 ret void
3939 }
40 define x86_fastcallcc void @"\01@f7@0"() comdat $"\01@f7@0" {
40 define x86_fastcallcc void @"\01@f7@0"() comdat($"\01@f7@0") {
4141 ret void
4242 }
4343
4444 $f8 = comdat any
45 define x86_fastcallcc void @v8() comdat $f8 {
45 define x86_fastcallcc void @v8() comdat($f8) {
4646 ret void
4747 }
48 define x86_fastcallcc void @f8() comdat $f8 {
48 define x86_fastcallcc void @f8() comdat($f8) {
4949 ret void
5050 }
5151
5252 $vftable = comdat largest
5353
54 @some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat $vftable
54 @some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat($vftable)
5555 @vftable = alias getelementptr([2 x i8*]* @some_name, i32 0, i32 1)
5656
5757 ; CHECK: .section .text,"xr",discard,_f1
44
55 $foo = comdat largest
66 @foo = global i32 0
7 @bar = global i32 0, comdat $foo
7 @bar = global i32 0, comdat($foo)
88 ; CHECK: Associative COMDAT symbol 'foo' is not a key for its COMDAT.
33 target triple = "i686-pc-windows-msvc"
44
55 $foo = comdat largest
6 @bar = global i32 0, comdat $foo
6 @bar = global i32 0, comdat($foo)
77 ; CHECK: Associative COMDAT symbol 'foo' does not exist.
0 ; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
11
22 $f = comdat any
3 @v = global i32 0, comdat $f
4 define void @f() comdat $f {
3 @v = global i32 0, comdat($f)
4 define void @f() comdat($f) {
55 ret void
66 }
77 ; CHECK: .section .text.f,"axG",@progbits,f,comdat
0 ; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
11
22 $foo = comdat any
3 @bar = global i32 42, comdat $foo
3 @bar = global i32 42, comdat($foo)
44 @foo = global i32 42
55
66 ; CHECK: .type bar,@object
11 ; RUN: FileCheck < %t %s
22
33 $f = comdat any
4 @v = global i32 0, comdat $f
4 @v = global i32 0, comdat($f)
55 ; CHECK: LLVM ERROR: MachO doesn't support COMDATs, 'f' cannot be lowered.
55 $f2 = comdat any
66 ; CHECK-NOT: f2
77
8 @v = global i32 0, comdat $f
9 ; CHECK: @v = global i32 0, comdat $f
8 @v = global i32 0, comdat($f)
9 ; CHECK: @v = global i32 0, comdat($f)
1010
1111 @a = alias i32* @v
1212 ; CHECK: @a = alias i32* @v{{$}}
1313
14 define void @f() comdat $f {
14 define void @f() comdat($f) {
1515 ret void
1616 }
17 ; CHECK: define void @f() comdat $f
17 ; CHECK: define void @f() comdat {
1818
1919 $i = comdat largest
20 @i = internal global i32 0, comdat $i
20 @i = internal global i32 0, comdat($i)
44 target triple = "i686-pc-windows-msvc"
55 ; no action should be taken for these globals
66 $global_noinst = comdat largest
7 @aliasee = private unnamed_addr constant [2 x i8] [i8 1, i8 2], comdat $global_noinst
7 @aliasee = private unnamed_addr constant [2 x i8] [i8 1, i8 2], comdat($global_noinst)
88 @global_noinst = unnamed_addr alias [2 x i8]* @aliasee
99 ; CHECK-NOT: {{asan_gen.*global_noinst}}
1010 ; CHECK-DAG: @global_noinst = unnamed_addr alias [2 x i8]* @aliasee
11 target triple = "i686-pc-windows-msvc"
22
33 $foo = comdat largest
4 @foo = global i64 43, comdat $foo
4 @foo = global i64 43, comdat($foo)
55
6 define i32 @bar() comdat $foo {
6 define i32 @bar() comdat($foo) {
77 ret i32 43
88 }
99
1010 $qux = comdat largest
11 @qux = global i32 13, comdat $qux
12 @in_unselected_group = global i32 13, comdat $qux
11 @qux = global i32 13, comdat($qux)
12 @in_unselected_group = global i32 13, comdat($qux)
1313
14 define i32 @baz() comdat $qux {
14 define i32 @baz() comdat($qux) {
1515 ret i32 13
1616 }
1717
1818 $any = comdat any
19 @any = global i64 7, comdat $any
19 @any = global i64 7, comdat($any)
0 $foo = comdat largest
1 @foo = global i64 43, comdat $foo
1 @foo = global i64 43, comdat($foo)
0 $foo = comdat noduplicates
1 @foo = global i64 43, comdat $foo
1 @foo = global i64 43, comdat($foo)
11 target triple = "i686-pc-windows-msvc"
22
33 $foo = comdat samesize
4 @foo = global i64 42, comdat $foo
4 @foo = global i64 42, comdat($foo)
22 $foo = comdat largest
33
44 @zed = external constant i8
5 @some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat $foo
5 @some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat($foo)
66 @foo = alias getelementptr([2 x i8*]* @some_name, i32 0, i32 1)
77
88 declare void @bar() unnamed_addr
0 $c1 = comdat largest
11
2 @some_name = private unnamed_addr constant i32 42, comdat $c1
2 @some_name = private unnamed_addr constant i32 42, comdat($c1)
33 @c1 = alias i32* @some_name
33 @v1 = weak hidden global i32 0
44 @v2 = weak protected global i32 0
55 @v3 = weak hidden global i32 0
6 @v4 = hidden global i32 1, comdat $c1
6 @v4 = hidden global i32 1, comdat($c1)
77
88 ; Aliases
99 @a1 = weak hidden alias i32* @v1
22 target triple = "i686-pc-windows-msvc"
33
44 $foo = comdat largest
5 @foo = global i32 42, comdat $foo
5 @foo = global i32 42, comdat($foo)
66
7 define i32 @bar() comdat $foo {
7 define i32 @bar() comdat($foo) {
88 ret i32 42
99 }
1010
1111 $qux = comdat largest
12 @qux = global i64 12, comdat $qux
12 @qux = global i64 12, comdat($qux)
1313
14 define i32 @baz() comdat $qux {
14 define i32 @baz() comdat($qux) {
1515 ret i32 12
1616 }
1717
1818 $any = comdat any
19 @any = global i64 6, comdat $any
19 @any = global i64 6, comdat($any)
2020
2121 ; CHECK: $qux = comdat largest
2222 ; CHECK: $foo = comdat largest
2323 ; CHECK: $any = comdat any
2424
25 ; CHECK: @qux = global i64 12, comdat $qux
26 ; CHECK: @any = global i64 6, comdat $any
27 ; CHECK: @foo = global i64 43, comdat $foo
25 ; CHECK: @qux = global i64 12, comdat{{$}}
26 ; CHECK: @any = global i64 6, comdat{{$}}
27 ; CHECK: @foo = global i64 43, comdat{{$}}
2828 ; CHECK-NOT: @in_unselected_group = global i32 13, comdat $qux
2929
30 ; CHECK: define i32 @baz() comdat $qux
31 ; CHECK: define i32 @bar() comdat $foo
30 ; CHECK: define i32 @baz() comdat($qux)
31 ; CHECK: define i32 @bar() comdat($foo)
22 target triple = "i686-pc-windows-msvc"
33
44 $foo = comdat samesize
5 @foo = global i32 42, comdat $foo
5 @foo = global i32 42, comdat($foo)
66 ; CHECK: Linking COMDATs named 'foo': invalid selection kinds!
0 ; RUN: not llvm-link %s %p/Inputs/comdat2.ll -S -o - 2>&1 | FileCheck %s
11
22 $foo = comdat largest
3 @foo = global i32 43, comdat $foo
3 @foo = global i32 43, comdat($foo)
44 ; CHECK: Linking COMDATs named 'foo': can't do size dependent selection without DataLayout!
0 ; RUN: not llvm-link %s %p/Inputs/comdat3.ll -S -o - 2>&1 | FileCheck %s
11
22 $foo = comdat noduplicates
3 @foo = global i64 43, comdat $foo
3 @foo = global i64 43, comdat($foo)
44 ; CHECK: Linking COMDATs named 'foo': noduplicates has been violated!
22 target triple = "i686-pc-windows-msvc"
33
44 $foo = comdat samesize
5 @foo = global i32 42, comdat $foo
5 @foo = global i32 42, comdat($foo)
66 ; CHECK: Linking COMDATs named 'foo': SameSize violated!
22 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
33
44 $foo = comdat largest
5 @foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat $foo
5 @foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat($foo)
66
77 ; CHECK: @foo = alias getelementptr inbounds ([2 x i8*]* @some_name, i32 0, i32 1)
88
11
22 $c1 = comdat largest
33
4 define void @c1() comdat $c1 {
4 define void @c1() comdat($c1) {
55 ret void
66 }
77 ; CHECK: GlobalVariable required for data dependent selection!
11
22 $c1 = comdat largest
33
4 @some_name = private unnamed_addr constant i32 42, comdat $c1
4 @some_name = private unnamed_addr constant i32 42, comdat($c1)
55 @c1 = alias i8* inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*)
66
77 ; CHECK: COMDAT key involves incomputable alias size.
11
22 $c = comdat any
33 @a = alias void ()* @f
4 define internal void @f() comdat $c {
4 define internal void @f() comdat($c) {
55 ret void
66 }
77
88 ; CHECK-DAG: $c = comdat any
99 ; CHECK-DAG: @a = alias void ()* @f
10 ; CHECK-DAG: define internal void @f() comdat $c
10 ; CHECK-DAG: define internal void @f() comdat($c)
1111
1212 $f2 = comdat largest
13 define internal void @f2() comdat $f2 {
13 define internal void @f2() comdat($f2) {
1414 ret void
1515 }
1616
1717 ; CHECK-DAG: $f2 = comdat largest
18 ; CHECK-DAG: define internal void @f2() comdat $f2
18 ; CHECK-DAG: define internal void @f2() comdat {
66 @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
77 ; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
88
9 ; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
10 define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
9 ; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
10 define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
1111 ret void
1212 }
1616 ; CHECK-DAG: @v3 = hidden global i32 0
1717 @v3 = protected global i32 0
1818
19 ; CHECK-DAG: @v4 = hidden global i32 1, comdat $c1
20 @v4 = global i32 1, comdat $c1
19 ; CHECK-DAG: @v4 = hidden global i32 1, comdat($c1)
20 @v4 = global i32 1, comdat($c1)
2121
2222 ; Aliases
2323 ; CHECK: @a1 = hidden alias i32* @v1
55 @a1 = linkonce_odr alias void ()* @f1
66 ; CHECK: @a1 = linkonce_odr alias void ()* @f1
77
8 define linkonce_odr void @f1() comdat $c1 {
8 define linkonce_odr void @f1() comdat($c1) {
99 ret void
1010 }
11 ; CHECK: define linkonce_odr void @f1() comdat $c1
11 ; CHECK: define linkonce_odr void @f1() comdat($c1)
1212
1313 define void @g() {
1414 call void @f1()
22 $c = comdat any
33 ; CHECK: $c = comdat any
44
5 define linkonce_odr void @foo() comdat $c {
5 define linkonce_odr void @foo() comdat($c) {
66 ret void
77 }
8 ; CHECK: define linkonce_odr void @foo() comdat $c
8 ; CHECK: define linkonce_odr void @foo() comdat($c)
99
10 define linkonce_odr void @bar() comdat $c {
10 define linkonce_odr void @bar() comdat($c) {
1111 ret void
1212 }
13 ; CHECK: define linkonce_odr void @bar() comdat $c
13 ; CHECK: define linkonce_odr void @bar() comdat($c)
1414
1515 define void @zed() {
1616 call void @foo()
11
22 $comdat_global = comdat any
33
4 @comdat_global = weak_odr global i8 0, comdat $comdat_global
4 @comdat_global = weak_odr global i8 0, comdat($comdat_global)
55 @simple_global = internal global i8 0
6 ; CHECK: @comdat_global = weak_odr global i8 0, comdat $comdat_global
6 ; CHECK: @comdat_global = weak_odr global i8 0, comdat{{$}}
77 ; CHECK: @simple_global = internal global i8 42
88
99 @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [
1919 }
2020 ; CHECK: define void @init_comdat_global()
2121
22 define internal void @init_simple_global() comdat $comdat_global {
22 define internal void @init_simple_global() comdat($comdat_global) {
2323 store i8 42, i8* @simple_global
2424 ret void
2525 }
22 $c = comdat any
33 ; CHECK: $c = comdat any
44
5 define linkonce_odr void @foo() comdat $c {
5 define linkonce_odr void @foo() comdat($c) {
66 ret void
77 }
8 ; CHECK: define linkonce_odr void @foo() comdat $c
8 ; CHECK: define linkonce_odr void @foo() comdat($c)
99
10 define linkonce_odr void @bar() comdat $c {
10 define linkonce_odr void @bar() comdat($c) {
1111 ret void
1212 }
13 ; CHECK: define linkonce_odr void @bar() comdat $c
13 ; CHECK: define linkonce_odr void @bar() comdat($c)
1414
1515 define void()* @zed() {
1616 ret void()* @foo
0 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
11
22 $v = comdat any
3 @v = common global i32 0, comdat $v
3 @v = common global i32 0, comdat($v)
44 ; CHECK: 'common' global may not be in a Comdat!
0 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
11
22 $v = comdat any
3 @v = private global i32 0, comdat $v
3 @v = private global i32 0, comdat($v)
44 ; CHECK: comdat global value has private linkage
0 $c2 = comdat any
11
2 @v1 = weak_odr global i32 41, comdat $c2
3 define weak_odr protected i32 @f1(i8* %this) comdat $c2 {
2 @v1 = weak_odr global i32 41, comdat($c2)
3 define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
44 bb20:
55 store i8* %this, i8** null
66 br label %bb21
55
66 $c1 = comdat any
77
8 @v1 = weak_odr global i32 42, comdat $c1
9 define weak_odr i32 @f1(i8*) comdat $c1 {
8 @v1 = weak_odr global i32 42, comdat($c1)
9 define weak_odr i32 @f1(i8*) comdat($c1) {
1010 bb10:
1111 br label %bb11
1212 bb11:
2626 ; CHECK: $c1 = comdat any
2727 ; CHECK: $c2 = comdat any
2828
29 ; CHECK: @v1 = weak_odr global i32 42, comdat $c1
29 ; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
3030
3131 ; CHECK: @r11 = global i32* @v1{{$}}
3232 ; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
3434 ; CHECK: @r21 = global i32* @v1{{$}}
3535 ; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
3636
37 ; CHECK: @v11 = internal global i32 41, comdat $c2
37 ; CHECK: @v11 = internal global i32 41, comdat($c2)
3838
3939 ; CHECK: @a11 = alias i32* @v1{{$}}
4040 ; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
4848 ; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
4949 ; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 to i16*)
5050
51 ; CHECK: define weak_odr protected i32 @f1(i8*) comdat $c1 {
51 ; CHECK: define weak_odr protected i32 @f1(i8*) comdat($c1) {
5252 ; CHECK-NEXT: bb10:
5353 ; CHECK-NEXT: br label %bb11{{$}}
5454 ; CHECK: bb11:
5555 ; CHECK-NEXT: ret i32 42
5656 ; CHECK-NEXT: }
5757
58 ; CHECK: define internal i32 @f12(i8* %this) comdat $c2 {
58 ; CHECK: define internal i32 @f12(i8* %this) comdat($c2) {
5959 ; CHECK-NEXT: bb20:
6060 ; CHECK-NEXT: store i8* %this, i8** null
6161 ; CHECK-NEXT: br label %bb21