summaryrefslogtreecommitdiff
path: root/test/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'test/Bitcode')
-rw-r--r--test/Bitcode/DILocalVariable-explicit-tags.ll8
-rw-r--r--test/Bitcode/DILocalVariable-explicit-tags.ll.bcbin500 -> 628 bytes
-rw-r--r--test/Bitcode/DISubprogram-distinct-definitions.ll11
-rw-r--r--test/Bitcode/DISubprogram-distinct-definitions.ll.bcbin512 -> 656 bytes
-rw-r--r--test/Bitcode/Inputs/invalid-fixme-streaming-blob.bcbin371 -> 0 bytes
-rw-r--r--test/Bitcode/Inputs/invalid-gep-no-operands.bcbin0 -> 452 bytes
-rw-r--r--test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bcbin0 -> 452 bytes
-rw-r--r--test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bcbin0 -> 452 bytes
-rw-r--r--test/Bitcode/Inputs/invalid-void-constant.bcbin0 -> 452 bytes
-rw-r--r--test/Bitcode/Inputs/module_hash.ll4
-rw-r--r--test/Bitcode/Inputs/source-filename.bcbin0 -> 792 bytes
-rw-r--r--test/Bitcode/Inputs/thinlto-alias.ll13
-rw-r--r--test/Bitcode/Inputs/thinlto-function-summary-callgraph-pgo.ll11
-rw-r--r--test/Bitcode/Inputs/thinlto-function-summary-callgraph.ll10
-rw-r--r--test/Bitcode/attributes.ll54
-rw-r--r--test/Bitcode/auto_upgrade_intrinsics.bcbin0 -> 1672 bytes
-rw-r--r--test/Bitcode/avr-calling-conventions.ll16
-rw-r--r--test/Bitcode/avr-calling-conventions.ll.bcbin0 -> 704 bytes
-rw-r--r--test/Bitcode/bitcode-wrapper-header-armv7m.ll5
-rw-r--r--test/Bitcode/bitcode-wrapper-header-x86_64.ll5
-rw-r--r--test/Bitcode/compatibility-3.8.ll1590
-rw-r--r--test/Bitcode/compatibility-3.8.ll.bcbin0 -> 15072 bytes
-rw-r--r--test/Bitcode/compatibility.ll88
-rw-r--r--test/Bitcode/debug-loc-again.ll6
-rw-r--r--test/Bitcode/dityperefs-3.8.ll43
-rw-r--r--test/Bitcode/dityperefs-3.8.ll.bcbin0 -> 888 bytes
-rw-r--r--test/Bitcode/invalid.ll2
-rw-r--r--test/Bitcode/invalid.ll.bcbin688 -> 688 bytes
-rw-r--r--test/Bitcode/invalid.test25
-rw-r--r--test/Bitcode/mdnodes-distinct-in-post-order.ll24
-rw-r--r--test/Bitcode/mdnodes-distinct-nodes-break-cycles.ll29
-rw-r--r--test/Bitcode/mdnodes-distinct-nodes-first.ll18
-rw-r--r--test/Bitcode/mdnodes-in-post-order.ll34
-rw-r--r--test/Bitcode/metadata-function-blocks.ll75
-rw-r--r--test/Bitcode/metadata-only-empty-string.ll7
-rw-r--r--test/Bitcode/metadata-strings.ll12
-rw-r--r--test/Bitcode/module_hash.ll35
-rw-r--r--test/Bitcode/operand-bundles-bc-analyzer.ll27
-rw-r--r--test/Bitcode/source-filename.test2
-rw-r--r--test/Bitcode/summary_version.ll12
-rw-r--r--test/Bitcode/thinlto-alias.ll47
-rw-r--r--test/Bitcode/thinlto-function-summary-callgraph-pgo.ll46
-rw-r--r--test/Bitcode/thinlto-function-summary-callgraph.ll44
-rw-r--r--test/Bitcode/thinlto-function-summary-originalnames.ll32
-rw-r--r--test/Bitcode/thinlto-function-summary-refgraph.ll121
-rw-r--r--test/Bitcode/thinlto-function-summary.ll33
-rw-r--r--test/Bitcode/thinlto-summary-globalvar.ll5
-rw-r--r--test/Bitcode/thinlto-summary-linkage-types.ll61
-rw-r--r--test/Bitcode/thinlto-summary-section.ll11
-rw-r--r--test/Bitcode/upgrade-module-flag.ll9
-rw-r--r--test/Bitcode/upgrade-subprogram-this.ll30
-rw-r--r--test/Bitcode/upgrade-subprogram-this.ll.bcbin0 -> 1084 bytes
-rw-r--r--test/Bitcode/upgrade-subprogram.ll2
53 files changed, 2573 insertions, 34 deletions
diff --git a/test/Bitcode/DILocalVariable-explicit-tags.ll b/test/Bitcode/DILocalVariable-explicit-tags.ll
index 3f7be3c061a31..b3e793d4cb463 100644
--- a/test/Bitcode/DILocalVariable-explicit-tags.ll
+++ b/test/Bitcode/DILocalVariable-explicit-tags.ll
@@ -10,7 +10,13 @@
!named = !{!0}
-!0 = distinct !DISubprogram(name: "foo", variables: !1)
+!llvm.module.flags = !{!6}
+!llvm.dbg.cu = !{!4}
+
+!0 = distinct !DISubprogram(name: "foo", scope: null, isLocal: false, isDefinition: true, isOptimized: false, variables: !1)
!1 = !{!2, !3}
!2 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "param", arg: 1, scope: !0)
!3 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "auto", scope: !0)
+!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !5, subprograms: !{!0})
+!5 = !DIFile(filename: "source.c", directory: "/dir")
+!6 = !{i32 1, !"Debug Info Version", i32 3}
diff --git a/test/Bitcode/DILocalVariable-explicit-tags.ll.bc b/test/Bitcode/DILocalVariable-explicit-tags.ll.bc
index 4efcbe878f84c..b134f60a12915 100644
--- a/test/Bitcode/DILocalVariable-explicit-tags.ll.bc
+++ b/test/Bitcode/DILocalVariable-explicit-tags.ll.bc
Binary files differ
diff --git a/test/Bitcode/DISubprogram-distinct-definitions.ll b/test/Bitcode/DISubprogram-distinct-definitions.ll
index 5c6fb908be908..bcb9a4ec4da66 100644
--- a/test/Bitcode/DISubprogram-distinct-definitions.ll
+++ b/test/Bitcode/DISubprogram-distinct-definitions.ll
@@ -1,11 +1,14 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; Check that subprogram definitions are correctly upgraded to 'distinct'.
-; Bitcode compiled from r245235 of the 3.7 release branch.
+; Bitcode compiled with llvm-as version 3.7.
-!named = !{!0}
-!0 = distinct !DICompileUnit(language: 12, file: !1, subprograms: !2)
+define void @f() !dbg !3 { ret void }
+
+!llvm.module.flags = !{!4}
+!llvm.dbg.cu = !{!0}
+!0 = distinct !DICompileUnit(language: 12, file: !1, subprograms: !{!3})
!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
-!2 = !{!3}
; CHECK: = distinct !DISubprogram({{.*}}, isDefinition: true
!3 = !DISubprogram(name: "foo", isDefinition: true)
+!4 = !{i32 2, !"Debug Info Version", i32 3}
diff --git a/test/Bitcode/DISubprogram-distinct-definitions.ll.bc b/test/Bitcode/DISubprogram-distinct-definitions.ll.bc
index 600f68facc3aa..edf31706dad72 100644
--- a/test/Bitcode/DISubprogram-distinct-definitions.ll.bc
+++ b/test/Bitcode/DISubprogram-distinct-definitions.ll.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc b/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
deleted file mode 100644
index 7e32f8b0774f9..0000000000000
--- a/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
+++ /dev/null
Binary files differ
diff --git a/test/Bitcode/Inputs/invalid-gep-no-operands.bc b/test/Bitcode/Inputs/invalid-gep-no-operands.bc
new file mode 100644
index 0000000000000..699c8b5c9a0f6
--- /dev/null
+++ b/test/Bitcode/Inputs/invalid-gep-no-operands.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc b/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc
new file mode 100644
index 0000000000000..2148fb216d7a0
--- /dev/null
+++ b/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc b/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
new file mode 100644
index 0000000000000..042fea51a5973
--- /dev/null
+++ b/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/invalid-void-constant.bc b/test/Bitcode/Inputs/invalid-void-constant.bc
new file mode 100644
index 0000000000000..7ab7b4167e3e2
--- /dev/null
+++ b/test/Bitcode/Inputs/invalid-void-constant.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/module_hash.ll b/test/Bitcode/Inputs/module_hash.ll
new file mode 100644
index 0000000000000..1d422c6e81758
--- /dev/null
+++ b/test/Bitcode/Inputs/module_hash.ll
@@ -0,0 +1,4 @@
+; Needs a function for the combined index to be populated
+define void @bar() {
+ ret void
+}
diff --git a/test/Bitcode/Inputs/source-filename.bc b/test/Bitcode/Inputs/source-filename.bc
new file mode 100644
index 0000000000000..3f327f4bf3c49
--- /dev/null
+++ b/test/Bitcode/Inputs/source-filename.bc
Binary files differ
diff --git a/test/Bitcode/Inputs/thinlto-alias.ll b/test/Bitcode/Inputs/thinlto-alias.ll
new file mode 100644
index 0000000000000..5a628e8a3b970
--- /dev/null
+++ b/test/Bitcode/Inputs/thinlto-alias.ll
@@ -0,0 +1,13 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+
+
+@analias = alias void (...), bitcast (void ()* @aliasee to void (...)*)
+
+; Function Attrs: nounwind uwtable
+define void @aliasee() #0 {
+entry:
+ ret void
+}
+
diff --git a/test/Bitcode/Inputs/thinlto-function-summary-callgraph-pgo.ll b/test/Bitcode/Inputs/thinlto-function-summary-callgraph-pgo.ll
new file mode 100644
index 0000000000000..f51ea4d500ba8
--- /dev/null
+++ b/test/Bitcode/Inputs/thinlto-function-summary-callgraph-pgo.ll
@@ -0,0 +1,11 @@
+; ModuleID = 'thinlto-function-summary-callgraph2.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define void @func() #0 !prof !2 {
+entry:
+ ret void
+}
+
+!2 = !{!"function_entry_count", i64 1}
diff --git a/test/Bitcode/Inputs/thinlto-function-summary-callgraph.ll b/test/Bitcode/Inputs/thinlto-function-summary-callgraph.ll
new file mode 100644
index 0000000000000..c6ede3252d882
--- /dev/null
+++ b/test/Bitcode/Inputs/thinlto-function-summary-callgraph.ll
@@ -0,0 +1,10 @@
+; ModuleID = 'thinlto-function-summary-callgraph2.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define void @func() #0 {
+entry:
+ ret void
+}
+
diff --git a/test/Bitcode/attributes.ll b/test/Bitcode/attributes.ll
index 1b3526f1fa0de..9fdf54b7b3085 100644
--- a/test/Bitcode/attributes.ll
+++ b/test/Bitcode/attributes.ll
@@ -204,7 +204,7 @@ define void @f34()
; CHECK: define void @f34()
{
call void @nobuiltin() nobuiltin
-; CHECK: call void @nobuiltin() #30
+; CHECK: call void @nobuiltin() #33
ret void;
}
@@ -287,6 +287,53 @@ define void @f49() inaccessiblemem_or_argmemonly {
ret void
}
+; CHECK: define void @f50(i8* swiftself)
+define void @f50(i8* swiftself)
+{
+ ret void;
+}
+
+; CHECK: define i32 @f51(i8** swifterror)
+define i32 @f51(i8** swifterror)
+{
+ ret i32 0
+}
+
+; CHECK: define i32 @f52(i32, i8** swifterror)
+define i32 @f52(i32, i8** swifterror)
+{
+ ret i32 0
+}
+
+%swift_error = type {i64, i8}
+declare float @foo(%swift_error** swifterror %error_ptr_ref)
+
+; CHECK: define float @f53
+; CHECK: alloca swifterror
+define float @f53(i8* %error_ref) {
+entry:
+ %error_ptr_ref = alloca swifterror %swift_error*
+ store %swift_error* null, %swift_error** %error_ptr_ref
+ %call = call float @foo(%swift_error** swifterror %error_ptr_ref)
+ ret float 1.0
+}
+
+; CHECK: define i8* @f54(i32) #30
+define i8* @f54(i32) allocsize(0) {
+ ret i8* null
+}
+
+; CHECK: define i8* @f55(i32, i32) #31
+define i8* @f55(i32, i32) allocsize(0, 1) {
+ ret i8* null
+}
+
+; CHECK: define void @f56() #32
+define void @f56() writeonly
+{
+ ret void
+}
+
; CHECK: attributes #0 = { noreturn }
; CHECK: attributes #1 = { nounwind }
; CHECK: attributes #2 = { readnone }
@@ -317,4 +364,7 @@ define void @f49() inaccessiblemem_or_argmemonly {
; CHECK: attributes #27 = { norecurse }
; CHECK: attributes #28 = { inaccessiblememonly }
; CHECK: attributes #29 = { inaccessiblemem_or_argmemonly }
-; CHECK: attributes #30 = { nobuiltin }
+; CHECK: attributes #30 = { allocsize(0) }
+; CHECK: attributes #31 = { allocsize(0,1) }
+; CHECK: attributes #32 = { writeonly }
+; CHECK: attributes #33 = { nobuiltin }
diff --git a/test/Bitcode/auto_upgrade_intrinsics.bc b/test/Bitcode/auto_upgrade_intrinsics.bc
new file mode 100644
index 0000000000000..9205c8ae4d3a3
--- /dev/null
+++ b/test/Bitcode/auto_upgrade_intrinsics.bc
Binary files differ
diff --git a/test/Bitcode/avr-calling-conventions.ll b/test/Bitcode/avr-calling-conventions.ll
new file mode 100644
index 0000000000000..ea1005d1477e8
--- /dev/null
+++ b/test/Bitcode/avr-calling-conventions.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-dis < %s.bc | FileCheck %s
+
+; CHECK: define avr_intrcc void @foo(i8)
+define avr_intrcc void @foo(i8) {
+ ret void
+}
+
+; CHECK: define avr_signalcc void @bar(i8)
+define avr_signalcc void @bar(i8) {
+ ret void
+}
+
+; CHECK: define void @baz(i8)
+define void @baz(i8) {
+ ret void
+}
diff --git a/test/Bitcode/avr-calling-conventions.ll.bc b/test/Bitcode/avr-calling-conventions.ll.bc
new file mode 100644
index 0000000000000..85e9c14e6e95f
--- /dev/null
+++ b/test/Bitcode/avr-calling-conventions.ll.bc
Binary files differ
diff --git a/test/Bitcode/bitcode-wrapper-header-armv7m.ll b/test/Bitcode/bitcode-wrapper-header-armv7m.ll
new file mode 100644
index 0000000000000..0639e01c096fe
--- /dev/null
+++ b/test/Bitcode/bitcode-wrapper-header-armv7m.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+
+target triple = "thumbv7m-apple-unknown-macho"
+
+; CHECK: <BITCODE_WRAPPER_HEADER Magic=0x0b17c0de Version=0x{{[0-9a-f]+}} Offset=0x00000014 Size=0x{{[0-9a-f]+}} CPUType=0x0000000c/>
diff --git a/test/Bitcode/bitcode-wrapper-header-x86_64.ll b/test/Bitcode/bitcode-wrapper-header-x86_64.ll
new file mode 100644
index 0000000000000..dbad71922b5c6
--- /dev/null
+++ b/test/Bitcode/bitcode-wrapper-header-x86_64.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+
+target triple = "x86_64-apple-macosx10.11.0"
+
+; CHECK: <BITCODE_WRAPPER_HEADER Magic=0x0b17c0de Version=0x{{[0-9a-f]+}} Offset=0x00000014 Size=0x{{[0-9a-f]+}} CPUType=0x01000007/>
diff --git a/test/Bitcode/compatibility-3.8.ll b/test/Bitcode/compatibility-3.8.ll
new file mode 100644
index 0000000000000..79c1ecfac9fc3
--- /dev/null
+++ b/test/Bitcode/compatibility-3.8.ll
@@ -0,0 +1,1590 @@
+; Bitcode compatibility test for llvm 3.8.0
+;
+; N.b: This is 3.8-compatible IR. The CHECK lines occasionally differ from
+; the IR used to generate the bitcode, and may need to be updated.
+
+; RUN: llvm-dis < %s.bc | FileCheck %s
+
+target datalayout = "E"
+; CHECK: target datalayout = "E"
+
+target triple = "x86_64-apple-macosx10.10.0"
+; CHECK: target triple = "x86_64-apple-macosx10.10.0"
+
+;; Module-level assembly
+module asm "beep boop"
+; CHECK: module asm "beep boop"
+
+;; Comdats
+$comdat.any = comdat any
+; CHECK: $comdat.any = comdat any
+$comdat.exactmatch = comdat exactmatch
+; CHECK: $comdat.exactmatch = comdat exactmatch
+$comdat.largest = comdat largest
+; CHECK: $comdat.largest = comdat largest
+$comdat.noduplicates = comdat noduplicates
+; CHECK: $comdat.noduplicates = comdat noduplicates
+$comdat.samesize = comdat samesize
+; CHECK: $comdat.samesize = comdat samesize
+
+;; Constants
+@const.true = constant i1 true
+; CHECK: @const.true = constant i1 true
+@const.false = constant i1 false
+; CHECK: @const.false = constant i1 false
+@const.int = constant i32 zeroinitializer
+; CHECK: @const.int = constant i32 0
+@const.float = constant double 0.0
+; CHECK: @const.float = constant double 0.0
+@const.null = constant i8* null
+; CHECK: @const.null = constant i8* null
+%const.struct.type = type { i32, i8 }
+%const.struct.type.packed = type <{ i32, i8 }>
+@const.struct = constant %const.struct.type { i32 -1, i8 undef }
+; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef }
+@const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
+; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
+
+; CHECK: @constant.array.i8 = constant [3 x i8] c"\00\01\00"
+@constant.array.i8 = constant [3 x i8] [i8 -0, i8 1, i8 0]
+; CHECK: @constant.array.i16 = constant [3 x i16] [i16 0, i16 1, i16 0]
+@constant.array.i16 = constant [3 x i16] [i16 -0, i16 1, i16 0]
+; CHECK: @constant.array.i32 = constant [3 x i32] [i32 0, i32 1, i32 0]
+@constant.array.i32 = constant [3 x i32] [i32 -0, i32 1, i32 0]
+; CHECK: @constant.array.i64 = constant [3 x i64] [i64 0, i64 1, i64 0]
+@constant.array.i64 = constant [3 x i64] [i64 -0, i64 1, i64 0]
+; CHECK: @constant.array.f16 = constant [3 x half] [half 0xH8000, half 0xH3C00, half 0xH0000]
+@constant.array.f16 = constant [3 x half] [half -0.0, half 1.0, half 0.0]
+; CHECK: @constant.array.f32 = constant [3 x float] [float -0.000000e+00, float 1.000000e+00, float 0.000000e+00]
+@constant.array.f32 = constant [3 x float] [float -0.0, float 1.0, float 0.0]
+; CHECK: @constant.array.f64 = constant [3 x double] [double -0.000000e+00, double 1.000000e+00, double 0.000000e+00]
+@constant.array.f64 = constant [3 x double] [double -0.0, double 1.0, double 0.0]
+
+; CHECK: @constant.vector.i8 = constant <3 x i8> <i8 0, i8 1, i8 0>
+@constant.vector.i8 = constant <3 x i8> <i8 -0, i8 1, i8 0>
+; CHECK: @constant.vector.i16 = constant <3 x i16> <i16 0, i16 1, i16 0>
+@constant.vector.i16 = constant <3 x i16> <i16 -0, i16 1, i16 0>
+; CHECK: @constant.vector.i32 = constant <3 x i32> <i32 0, i32 1, i32 0>
+@constant.vector.i32 = constant <3 x i32> <i32 -0, i32 1, i32 0>
+; CHECK: @constant.vector.i64 = constant <3 x i64> <i64 0, i64 1, i64 0>
+@constant.vector.i64 = constant <3 x i64> <i64 -0, i64 1, i64 0>
+; CHECK: @constant.vector.f16 = constant <3 x half> <half 0xH8000, half 0xH3C00, half 0xH0000>
+@constant.vector.f16 = constant <3 x half> <half -0.0, half 1.0, half 0.0>
+; CHECK: @constant.vector.f32 = constant <3 x float> <float -0.000000e+00, float 1.000000e+00, float 0.000000e+00>
+@constant.vector.f32 = constant <3 x float> <float -0.0, float 1.0, float 0.0>
+; CHECK: @constant.vector.f64 = constant <3 x double> <double -0.000000e+00, double 1.000000e+00, double 0.000000e+00>
+@constant.vector.f64 = constant <3 x double> <double -0.0, double 1.0, double 0.0>
+
+;; Global Variables
+; Format: [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass]
+; [ThreadLocal] [unnamed_addr] [AddrSpace] [ExternallyInitialized]
+; <global | constant> <Type> [<InitializerConstant>]
+; [, section "name"] [, comdat [($name)]] [, align <Alignment>]
+
+; Global Variables -- Simple
+@g1 = global i32 0
+; CHECK: @g1 = global i32 0
+@g2 = constant i32 0
+; CHECK: @g2 = constant i32 0
+
+; Global Variables -- Linkage
+@g.private = private global i32 0
+; CHECK: @g.private = private global i32 0
+@g.internal = internal global i32 0
+; CHECK: @g.internal = internal global i32 0
+@g.available_externally = available_externally global i32 0
+; CHECK: @g.available_externally = available_externally global i32 0
+@g.linkonce = linkonce global i32 0
+; CHECK: @g.linkonce = linkonce global i32 0
+@g.weak = weak global i32 0
+; CHECK: @g.weak = weak global i32 0
+@g.common = common global i32 0
+; CHECK: @g.common = common global i32 0
+@g.appending = appending global [4 x i8] c"test"
+; CHECK: @g.appending = appending global [4 x i8] c"test"
+@g.extern_weak = extern_weak global i32
+; CHECK: @g.extern_weak = extern_weak global i32
+@g.linkonce_odr = linkonce_odr global i32 0
+; CHECK: @g.linkonce_odr = linkonce_odr global i32 0
+@g.weak_odr = weak_odr global i32 0
+; CHECK: @g.weak_odr = weak_odr global i32 0
+@g.external = external global i32
+; CHECK: @g.external = external global i32
+
+; Global Variables -- Visibility
+@g.default = default global i32 0
+; CHECK: @g.default = global i32 0
+@g.hidden = hidden global i32 0
+; CHECK: @g.hidden = hidden global i32 0
+@g.protected = protected global i32 0
+; CHECK: @g.protected = protected global i32 0
+
+; Global Variables -- DLLStorageClass
+@g.dlldefault = default global i32 0
+; CHECK: @g.dlldefault = global i32 0
+@g.dllimport = external dllimport global i32
+; CHECK: @g.dllimport = external dllimport global i32
+@g.dllexport = dllexport global i32 0
+; CHECK: @g.dllexport = dllexport global i32 0
+
+; Global Variables -- ThreadLocal
+@g.notthreadlocal = global i32 0
+; CHECK: @g.notthreadlocal = global i32 0
+@g.generaldynamic = thread_local global i32 0
+; CHECK: @g.generaldynamic = thread_local global i32 0
+@g.localdynamic = thread_local(localdynamic) global i32 0
+; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0
+@g.initialexec = thread_local(initialexec) global i32 0
+; CHECK: @g.initialexec = thread_local(initialexec) global i32 0
+@g.localexec = thread_local(localexec) global i32 0
+; CHECK: @g.localexec = thread_local(localexec) global i32 0
+
+; Global Variables -- unnamed_addr
+@g.unnamed_addr = unnamed_addr global i32 0
+; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
+
+; Global Variables -- AddrSpace
+@g.addrspace = addrspace(1) global i32 0
+; CHECK: @g.addrspace = addrspace(1) global i32 0
+
+; Global Variables -- ExternallyInitialized
+@g.externally_initialized = external externally_initialized global i32
+; CHECK: @g.externally_initialized = external externally_initialized global i32
+
+; Global Variables -- section
+@g.section = global i32 0, section "_DATA"
+; CHECK: @g.section = global i32 0, section "_DATA"
+
+; Global Variables -- comdat
+@comdat.any = global i32 0, comdat
+; CHECK: @comdat.any = global i32 0, comdat
+@comdat.exactmatch = global i32 0, comdat
+; CHECK: @comdat.exactmatch = global i32 0, comdat
+@comdat.largest = global i32 0, comdat
+; CHECK: @comdat.largest = global i32 0, comdat
+@comdat.noduplicates = global i32 0, comdat
+; CHECK: @comdat.noduplicates = global i32 0, comdat
+@comdat.samesize = global i32 0, comdat
+; CHECK: @comdat.samesize = global i32 0, comdat
+
+; Force two globals from different comdats into sections with the same name.
+$comdat1 = comdat any
+$comdat2 = comdat any
+@g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
+; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
+@g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
+; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
+
+; Global Variables -- align
+@g.align = global i32 0, align 4
+; CHECK: @g.align = global i32 0, align 4
+
+; Global Variables -- Intrinsics
+%pri.func.data = type { i32, void ()*, i8* }
+@g.used1 = global i32 0
+@g.used2 = global i32 0
+@g.used3 = global i8 0
+declare void @g.f1()
+@llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
+; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
+@llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
+; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
+@llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
+; CHECK: @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
+@llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
+; CHECK: @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
+
+;; Aliases
+; Format: @<Name> = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
+; [unnamed_addr] alias <AliaseeTy> @<Aliasee>
+
+; Aliases -- Linkage
+@a.private = private alias i32, i32* @g.private
+; CHECK: @a.private = private alias i32, i32* @g.private
+@a.internal = internal alias i32, i32* @g.internal
+; CHECK: @a.internal = internal alias i32, i32* @g.internal
+@a.linkonce = linkonce alias i32, i32* @g.linkonce
+; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
+@a.weak = weak alias i32, i32* @g.weak
+; CHECK: @a.weak = weak alias i32, i32* @g.weak
+@a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
+; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
+@a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
+; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
+@a.external = external alias i32, i32* @g1
+; CHECK: @a.external = alias i32, i32* @g1
+
+; Aliases -- Visibility
+@a.default = default alias i32, i32* @g.default
+; CHECK: @a.default = alias i32, i32* @g.default
+@a.hidden = hidden alias i32, i32* @g.hidden
+; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
+@a.protected = protected alias i32, i32* @g.protected
+; CHECK: @a.protected = protected alias i32, i32* @g.protected
+
+; Aliases -- DLLStorageClass
+@a.dlldefault = default alias i32, i32* @g.dlldefault
+; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
+@a.dllimport = dllimport alias i32, i32* @g1
+; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
+@a.dllexport = dllexport alias i32, i32* @g.dllexport
+; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
+
+; Aliases -- ThreadLocal
+@a.notthreadlocal = alias i32, i32* @g.notthreadlocal
+; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
+@a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
+; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
+@a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
+; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
+@a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
+; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
+@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
+; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
+
+; Aliases -- unnamed_addr
+@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
+; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
+
+;; Functions
+; Format: define [linkage] [visibility] [DLLStorageClass]
+; [cconv] [ret attrs]
+; <ResultType> @<FunctionName> ([argument list])
+; [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
+; [align N] [gc] [prefix Constant] [prologue Constant]
+; [personality Constant] { ... }
+
+; Functions -- Simple
+declare void @f1 ()
+; CHECK: declare void @f1()
+
+define void @f2 () {
+; CHECK: define void @f2()
+entry:
+ ret void
+}
+
+; Functions -- linkage
+define private void @f.private() {
+; CHECK: define private void @f.private()
+entry:
+ ret void
+}
+define internal void @f.internal() {
+; CHECK: define internal void @f.internal()
+entry:
+ ret void
+}
+define available_externally void @f.available_externally() {
+; CHECK: define available_externally void @f.available_externally()
+entry:
+ ret void
+}
+define linkonce void @f.linkonce() {
+; CHECK: define linkonce void @f.linkonce()
+entry:
+ ret void
+}
+define weak void @f.weak() {
+; CHECK: define weak void @f.weak()
+entry:
+ ret void
+}
+define linkonce_odr void @f.linkonce_odr() {
+; CHECK: define linkonce_odr void @f.linkonce_odr()
+entry:
+ ret void
+}
+define weak_odr void @f.weak_odr() {
+; CHECK: define weak_odr void @f.weak_odr()
+entry:
+ ret void
+}
+declare external void @f.external()
+; CHECK: declare void @f.external()
+declare extern_weak void @f.extern_weak()
+; CHECK: declare extern_weak void @f.extern_weak()
+
+; Functions -- visibility
+declare default void @f.default()
+; CHECK: declare void @f.default()
+declare hidden void @f.hidden()
+; CHECK: declare hidden void @f.hidden()
+declare protected void @f.protected()
+; CHECK: declare protected void @f.protected()
+
+; Functions -- DLLStorageClass
+declare dllimport void @f.dllimport()
+; CHECK: declare dllimport void @f.dllimport()
+declare dllexport void @f.dllexport()
+; CHECK: declare dllexport void @f.dllexport()
+
+; Functions -- cconv (Calling conventions)
+declare ccc void @f.ccc()
+; CHECK: declare void @f.ccc()
+declare fastcc void @f.fastcc()
+; CHECK: declare fastcc void @f.fastcc()
+declare coldcc void @f.coldcc()
+; CHECK: declare coldcc void @f.coldcc()
+declare cc10 void @f.cc10()
+; CHECK: declare ghccc void @f.cc10()
+declare ghccc void @f.ghccc()
+; CHECK: declare ghccc void @f.ghccc()
+declare cc11 void @f.cc11()
+; CHECK: declare cc11 void @f.cc11()
+declare webkit_jscc void @f.webkit_jscc()
+; CHECK: declare webkit_jscc void @f.webkit_jscc()
+declare anyregcc void @f.anyregcc()
+; CHECK: declare anyregcc void @f.anyregcc()
+declare preserve_mostcc void @f.preserve_mostcc()
+; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
+declare preserve_allcc void @f.preserve_allcc()
+; CHECK: declare preserve_allcc void @f.preserve_allcc()
+declare cc64 void @f.cc64()
+; CHECK: declare x86_stdcallcc void @f.cc64()
+declare x86_stdcallcc void @f.x86_stdcallcc()
+; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
+declare cc65 void @f.cc65()
+; CHECK: declare x86_fastcallcc void @f.cc65()
+declare x86_fastcallcc void @f.x86_fastcallcc()
+; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
+declare cc66 void @f.cc66()
+; CHECK: declare arm_apcscc void @f.cc66()
+declare arm_apcscc void @f.arm_apcscc()
+; CHECK: declare arm_apcscc void @f.arm_apcscc()
+declare cc67 void @f.cc67()
+; CHECK: declare arm_aapcscc void @f.cc67()
+declare arm_aapcscc void @f.arm_aapcscc()
+; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
+declare cc68 void @f.cc68()
+; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
+declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
+; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
+declare cc69 void @f.cc69()
+; CHECK: declare msp430_intrcc void @f.cc69()
+declare msp430_intrcc void @f.msp430_intrcc()
+; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
+declare cc70 void @f.cc70()
+; CHECK: declare x86_thiscallcc void @f.cc70()
+declare x86_thiscallcc void @f.x86_thiscallcc()
+; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
+declare cc71 void @f.cc71()
+; CHECK: declare ptx_kernel void @f.cc71()
+declare ptx_kernel void @f.ptx_kernel()
+; CHECK: declare ptx_kernel void @f.ptx_kernel()
+declare cc72 void @f.cc72()
+; CHECK: declare ptx_device void @f.cc72()
+declare ptx_device void @f.ptx_device()
+; CHECK: declare ptx_device void @f.ptx_device()
+declare cc75 void @f.cc75()
+; CHECK: declare spir_func void @f.cc75()
+declare spir_func void @f.spir_func()
+; CHECK: declare spir_func void @f.spir_func()
+declare cc76 void @f.cc76()
+; CHECK: declare spir_kernel void @f.cc76()
+declare spir_kernel void @f.spir_kernel()
+; CHECK: declare spir_kernel void @f.spir_kernel()
+declare cc77 void @f.cc77()
+; CHECK: declare intel_ocl_bicc void @f.cc77()
+declare intel_ocl_bicc void @f.intel_ocl_bicc()
+; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
+declare cc78 void @f.cc78()
+; CHECK: declare x86_64_sysvcc void @f.cc78()
+declare x86_64_sysvcc void @f.x86_64_sysvcc()
+; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
+declare cc79 void @f.cc79()
+; CHECK: declare x86_64_win64cc void @f.cc79()
+declare x86_64_win64cc void @f.x86_64_win64cc()
+; CHECK: declare x86_64_win64cc void @f.x86_64_win64cc()
+declare cc80 void @f.cc80()
+; CHECK: declare x86_vectorcallcc void @f.cc80()
+declare x86_vectorcallcc void @f.x86_vectorcallcc()
+; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
+declare cc1023 void @f.cc1023()
+; CHECK: declare cc1023 void @f.cc1023()
+
+; Functions -- ret attrs (Return attributes)
+declare zeroext i64 @f.zeroext()
+; CHECK: declare zeroext i64 @f.zeroext()
+declare signext i64 @f.signext()
+; CHECK: declare signext i64 @f.signext()
+declare inreg i32* @f.inreg()
+; CHECK: declare inreg i32* @f.inreg()
+declare noalias i32* @f.noalias()
+; CHECK: declare noalias i32* @f.noalias()
+declare nonnull i32* @f.nonnull()
+; CHECK: declare nonnull i32* @f.nonnull()
+declare dereferenceable(4) i32* @f.dereferenceable4()
+; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
+declare dereferenceable(8) i32* @f.dereferenceable8()
+; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
+declare dereferenceable(16) i32* @f.dereferenceable16()
+; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
+declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
+; CHECK: declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null()
+declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
+; CHECK: declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null()
+declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
+; CHECK: declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null()
+
+; Functions -- Parameter attributes
+declare void @f.param.zeroext(i8 zeroext)
+; CHECK: declare void @f.param.zeroext(i8 zeroext)
+declare void @f.param.signext(i8 signext)
+; CHECK: declare void @f.param.signext(i8 signext)
+declare void @f.param.inreg(i8 inreg)
+; CHECK: declare void @f.param.inreg(i8 inreg)
+declare void @f.param.byval({ i8, i8 }* byval)
+; CHECK: declare void @f.param.byval({ i8, i8 }* byval)
+declare void @f.param.inalloca(i8* inalloca)
+; CHECK: declare void @f.param.inalloca(i8* inalloca)
+declare void @f.param.sret(i8* sret)
+; CHECK: declare void @f.param.sret(i8* sret)
+declare void @f.param.noalias(i8* noalias)
+; CHECK: declare void @f.param.noalias(i8* noalias)
+declare void @f.param.nocapture(i8* nocapture)
+; CHECK: declare void @f.param.nocapture(i8* nocapture)
+declare void @f.param.nest(i8* nest)
+; CHECK: declare void @f.param.nest(i8* nest)
+declare i8* @f.param.returned(i8* returned)
+; CHECK: declare i8* @f.param.returned(i8* returned)
+declare void @f.param.nonnull(i8* nonnull)
+; CHECK: declare void @f.param.nonnull(i8* nonnull)
+declare void @f.param.dereferenceable(i8* dereferenceable(4))
+; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
+declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
+; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
+
+; Functions -- unnamed_addr
+declare void @f.unnamed_addr() unnamed_addr
+; CHECK: declare void @f.unnamed_addr() unnamed_addr
+
+; Functions -- fn Attrs (Function attributes)
+declare void @f.alignstack4() alignstack(4)
+; CHECK: declare void @f.alignstack4() #0
+declare void @f.alignstack8() alignstack(8)
+; CHECK: declare void @f.alignstack8() #1
+declare void @f.alwaysinline() alwaysinline
+; CHECK: declare void @f.alwaysinline() #2
+declare void @f.cold() cold
+; CHECK: declare void @f.cold() #3
+declare void @f.convergent() convergent
+; CHECK: declare void @f.convergent() #4
+declare void @f.inlinehint() inlinehint
+; CHECK: declare void @f.inlinehint() #5
+declare void @f.jumptable() unnamed_addr jumptable
+; CHECK: declare void @f.jumptable() unnamed_addr #6
+declare void @f.minsize() minsize
+; CHECK: declare void @f.minsize() #7
+declare void @f.naked() naked
+; CHECK: declare void @f.naked() #8
+declare void @f.nobuiltin() nobuiltin
+; CHECK: declare void @f.nobuiltin() #9
+declare void @f.noduplicate() noduplicate
+; CHECK: declare void @f.noduplicate() #10
+declare void @f.noimplicitfloat() noimplicitfloat
+; CHECK: declare void @f.noimplicitfloat() #11
+declare void @f.noinline() noinline
+; CHECK: declare void @f.noinline() #12
+declare void @f.nonlazybind() nonlazybind
+; CHECK: declare void @f.nonlazybind() #13
+declare void @f.noredzone() noredzone
+; CHECK: declare void @f.noredzone() #14
+declare void @f.noreturn() noreturn
+; CHECK: declare void @f.noreturn() #15
+declare void @f.nounwind() nounwind
+; CHECK: declare void @f.nounwind() #16
+declare void @f.optnone() noinline optnone
+; CHECK: declare void @f.optnone() #17
+declare void @f.optsize() optsize
+; CHECK: declare void @f.optsize() #18
+declare void @f.readnone() readnone
+; CHECK: declare void @f.readnone() #19
+declare void @f.readonly() readonly
+; CHECK: declare void @f.readonly() #20
+declare void @f.returns_twice() returns_twice
+; CHECK: declare void @f.returns_twice() #21
+declare void @f.safestack() safestack
+; CHECK: declare void @f.safestack() #22
+declare void @f.sanitize_address() sanitize_address
+; CHECK: declare void @f.sanitize_address() #23
+declare void @f.sanitize_memory() sanitize_memory
+; CHECK: declare void @f.sanitize_memory() #24
+declare void @f.sanitize_thread() sanitize_thread
+; CHECK: declare void @f.sanitize_thread() #25
+declare void @f.ssp() ssp
+; CHECK: declare void @f.ssp() #26
+declare void @f.sspreq() sspreq
+; CHECK: declare void @f.sspreq() #27
+declare void @f.sspstrong() sspstrong
+; CHECK: declare void @f.sspstrong() #28
+declare void @f.thunk() "thunk"
+; CHECK: declare void @f.thunk() #29
+declare void @f.uwtable() uwtable
+; CHECK: declare void @f.uwtable() #30
+declare void @f.kvpair() "cpu"="cortex-a8"
+; CHECK:declare void @f.kvpair() #31
+declare void @f.norecurse() norecurse
+; CHECK: declare void @f.norecurse() #32
+declare void @f.inaccessiblememonly() inaccessiblememonly
+; CHECK: declare void @f.inaccessiblememonly() #33
+declare void @f.inaccessiblemem_or_argmemonly() inaccessiblemem_or_argmemonly
+; CHECK: declare void @f.inaccessiblemem_or_argmemonly() #34
+
+; Functions -- section
+declare void @f.section() section "80"
+; CHECK: declare void @f.section() section "80"
+
+; Functions -- comdat
+define void @f.comdat_any() comdat($comdat.any) {
+; CHECK: define void @f.comdat_any() comdat($comdat.any)
+entry:
+ ret void
+}
+define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
+; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
+entry:
+ ret void
+}
+define void @f.comdat_largest() comdat($comdat.largest) {
+; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
+entry:
+ ret void
+}
+define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
+; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
+entry:
+ ret void
+}
+define void @f.comdat_samesize() comdat($comdat.samesize) {
+; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
+entry:
+ ret void
+}
+
+; Functions -- align
+declare void @f.align2() align 2
+; CHECK: declare void @f.align2() align 2
+declare void @f.align4() align 4
+; CHECK: declare void @f.align4() align 4
+declare void @f.align8() align 8
+; CHECK: declare void @f.align8() align 8
+
+; Functions -- GC
+declare void @f.gcshadow() gc "shadow-stack"
+; CHECK: declare void @f.gcshadow() gc "shadow-stack"
+
+; Functions -- Prefix data
+declare void @f.prefixi32() prefix i32 1684365668
+; CHECK: declare void @f.prefixi32() prefix i32 1684365668
+declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
+; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
+
+; Functions -- Prologue data
+declare void @f.prologuei32() prologue i32 1684365669
+; CHECK: declare void @f.prologuei32() prologue i32 1684365669
+declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
+; CHECK: declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3]
+
+; Functions -- Personality constant
+declare void @llvm.donothing() nounwind readnone
+; CHECK: declare void @llvm.donothing() #35
+define void @f.no_personality() personality i8 3 {
+; CHECK: define void @f.no_personality() personality i8 3
+ invoke void @llvm.donothing() to label %normal unwind label %exception
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+declare i32 @f.personality_handler()
+; CHECK: declare i32 @f.personality_handler()
+define void @f.personality() personality i32 ()* @f.personality_handler {
+; CHECK: define void @f.personality() personality i32 ()* @f.personality_handler
+ invoke void @llvm.donothing() to label %normal unwind label %exception
+exception:
+ %cleanup = landingpad i32 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+;; Atomic Memory Ordering Constraints
+define void @atomics(i32* %word) {
+ %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
+ ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
+ %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
+ ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
+ %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
+ ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
+ %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
+ ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
+ %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
+ ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
+ %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
+ ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
+ %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
+ ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
+ %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
+ ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
+ %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
+ ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
+ %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
+ ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
+ %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
+ ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
+ %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
+ ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
+ %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
+ ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
+ %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
+ ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
+ %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
+ ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
+ %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
+ ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
+ %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
+ ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
+ %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
+ ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
+ %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
+ ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
+ fence acquire
+ ; CHECK: fence acquire
+ fence release
+ ; CHECK: fence release
+ fence acq_rel
+ ; CHECK: fence acq_rel
+ fence singlethread seq_cst
+ ; CHECK: fence singlethread seq_cst
+
+ %ld.1 = load atomic i32, i32* %word monotonic, align 4
+ ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
+ %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
+ ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
+ %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
+ ; CHECK: %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
+
+ store atomic i32 23, i32* %word monotonic, align 4
+ ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
+ store atomic volatile i32 24, i32* %word monotonic, align 4
+ ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
+ store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
+ ; CHECK: store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
+ ret void
+}
+
+;; Fast Math Flags
+define void @fastmathflags(float %op1, float %op2) {
+ %f.nnan = fadd nnan float %op1, %op2
+ ; CHECK: %f.nnan = fadd nnan float %op1, %op2
+ %f.ninf = fadd ninf float %op1, %op2
+ ; CHECK: %f.ninf = fadd ninf float %op1, %op2
+ %f.nsz = fadd nsz float %op1, %op2
+ ; CHECK: %f.nsz = fadd nsz float %op1, %op2
+ %f.arcp = fadd arcp float %op1, %op2
+ ; CHECK: %f.arcp = fadd arcp float %op1, %op2
+ %f.fast = fadd fast float %op1, %op2
+ ; CHECK: %f.fast = fadd fast float %op1, %op2
+ ret void
+}
+
+; Check various fast math flags and floating-point types on calls.
+
+declare float @fmf1()
+declare double @fmf2()
+declare <4 x double> @fmf3()
+
+; CHECK-LABEL: fastMathFlagsForCalls(
+define void @fastMathFlagsForCalls(float %f, double %d1, <4 x double> %d2) {
+ %call.fast = call fast float @fmf1()
+ ; CHECK: %call.fast = call fast float @fmf1()
+
+ ; Throw in some other attributes to make sure those stay in the right places.
+
+ %call.nsz.arcp = notail call nsz arcp double @fmf2()
+ ; CHECK: %call.nsz.arcp = notail call nsz arcp double @fmf2()
+
+ %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
+ ; CHECK: %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3()
+
+ ret void
+}
+
+;; Type System
+%opaquety = type opaque
+define void @typesystem() {
+ %p0 = bitcast i8* null to i32 (i32)*
+ ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
+ %p1 = bitcast i8* null to void (i8*)*
+ ; CHECK: %p1 = bitcast i8* null to void (i8*)*
+ %p2 = bitcast i8* null to i32 (i8*, ...)*
+ ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
+ %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
+ ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
+ %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
+ ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
+ %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
+ ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
+
+ %t0 = alloca i1942652
+ ; CHECK: %t0 = alloca i1942652
+ %t1 = alloca half
+ ; CHECK: %t1 = alloca half
+ %t2 = alloca float
+ ; CHECK: %t2 = alloca float
+ %t3 = alloca double
+ ; CHECK: %t3 = alloca double
+ %t4 = alloca fp128
+ ; CHECK: %t4 = alloca fp128
+ %t5 = alloca x86_fp80
+ ; CHECK: %t5 = alloca x86_fp80
+ %t6 = alloca ppc_fp128
+ ; CHECK: %t6 = alloca ppc_fp128
+ %t7 = alloca x86_mmx
+ ; CHECK: %t7 = alloca x86_mmx
+ %t8 = alloca %opaquety*
+ ; CHECK: %t8 = alloca %opaquety*
+
+ ret void
+}
+
+declare void @llvm.token(token)
+; CHECK: declare void @llvm.token(token)
+
+;; Inline Assembler Expressions
+define void @inlineasm(i32 %arg) {
+ call i32 asm "bswap $0", "=r,r"(i32 %arg)
+ ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
+ call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
+ ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
+ ret void
+}
+
+;; Instructions
+
+; Instructions -- Terminators
+define void @instructions.terminators(i8 %val) personality i32 -10 {
+ br i1 false, label %iftrue, label %iffalse
+ ; CHECK: br i1 false, label %iftrue, label %iffalse
+ br label %iftrue
+ ; CHECK: br label %iftrue
+iftrue:
+ ret void
+ ; CHECK: ret void
+iffalse:
+
+ switch i8 %val, label %defaultdest [
+ ; CHECK: switch i8 %val, label %defaultdest [
+ i8 0, label %defaultdest.0
+ ; CHECK: i8 0, label %defaultdest.0
+ i8 1, label %defaultdest.1
+ ; CHECK: i8 1, label %defaultdest.1
+ i8 2, label %defaultdest.2
+ ; CHECK: i8 2, label %defaultdest.2
+ ]
+ ; CHECK: ]
+defaultdest:
+ ret void
+defaultdest.0:
+ ret void
+defaultdest.1:
+ ret void
+defaultdest.2:
+
+ indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
+ ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
+ indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
+ ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
+
+ invoke fastcc void @f.fastcc()
+ ; CHECK: invoke fastcc void @f.fastcc()
+ to label %defaultdest unwind label %exc
+ ; CHECK: to label %defaultdest unwind label %exc
+exc:
+ %cleanup = landingpad i32 cleanup
+
+ resume i32 undef
+ ; CHECK: resume i32 undef
+ unreachable
+ ; CHECK: unreachable
+
+ ret void
+}
+
+define i32 @instructions.win_eh.1() personality i32 -3 {
+entry:
+ %arg1 = alloca i32
+ %arg2 = alloca i32
+ invoke void @f.ccc() to label %normal unwind label %catchswitch1
+ invoke void @f.ccc() to label %normal unwind label %catchswitch2
+ invoke void @f.ccc() to label %normal unwind label %catchswitch3
+
+catchswitch1:
+ %cs1 = catchswitch within none [label %catchpad1] unwind to caller
+
+catchpad1:
+ catchpad within %cs1 []
+ br label %normal
+ ; CHECK: catchpad within %cs1 []
+ ; CHECK-NEXT: br label %normal
+
+catchswitch2:
+ %cs2 = catchswitch within none [label %catchpad2] unwind to caller
+
+catchpad2:
+ catchpad within %cs2 [i32* %arg1]
+ br label %normal
+ ; CHECK: catchpad within %cs2 [i32* %arg1]
+ ; CHECK-NEXT: br label %normal
+
+catchswitch3:
+ %cs3 = catchswitch within none [label %catchpad3] unwind label %cleanuppad1
+
+catchpad3:
+ catchpad within %cs3 [i32* %arg1, i32* %arg2]
+ br label %normal
+ ; CHECK: catchpad within %cs3 [i32* %arg1, i32* %arg2]
+ ; CHECK-NEXT: br label %normal
+
+cleanuppad1:
+ %clean.1 = cleanuppad within none []
+ unreachable
+ ; CHECK: %clean.1 = cleanuppad within none []
+ ; CHECK-NEXT: unreachable
+
+normal:
+ ret i32 0
+}
+;
+define i32 @instructions.win_eh.2() personality i32 -4 {
+entry:
+ invoke void @f.ccc() to label %invoke.cont unwind label %catchswitch
+
+invoke.cont:
+ invoke void @f.ccc() to label %continue unwind label %cleanup
+
+cleanup:
+ %clean = cleanuppad within none []
+ ; CHECK: %clean = cleanuppad within none []
+ cleanupret from %clean unwind to caller
+ ; CHECK: cleanupret from %clean unwind to caller
+
+catchswitch:
+ %cs = catchswitch within none [label %catchpad] unwind label %terminate
+
+catchpad:
+ %catch = catchpad within %cs []
+ br label %body
+ ; CHECK: %catch = catchpad within %cs []
+ ; CHECK-NEXT: br label %body
+
+body:
+ invoke void @f.ccc() [ "funclet"(token %catch) ]
+ to label %continue unwind label %terminate.inner
+ catchret from %catch to label %return
+ ; CHECK: catchret from %catch to label %return
+
+return:
+ ret i32 0
+
+terminate.inner:
+ cleanuppad within %catch []
+ unreachable
+ ; CHECK: cleanuppad within %catch []
+ ; CHECK-NEXT: unreachable
+
+terminate:
+ cleanuppad within none []
+ unreachable
+ ; CHECK: cleanuppad within none []
+ ; CHECK-NEXT: unreachable
+
+continue:
+ ret i32 0
+}
+
+; Instructions -- Binary Operations
+define void @instructions.binops(i8 %op1, i8 %op2) {
+ ; nuw x nsw
+ add i8 %op1, %op2
+ ; CHECK: add i8 %op1, %op2
+ add nuw i8 %op1, %op2
+ ; CHECK: add nuw i8 %op1, %op2
+ add nsw i8 %op1, %op2
+ ; CHECK: add nsw i8 %op1, %op2
+ add nuw nsw i8 %op1, %op2
+ ; CHECK: add nuw nsw i8 %op1, %op2
+ sub i8 %op1, %op2
+ ; CHECK: sub i8 %op1, %op2
+ sub nuw i8 %op1, %op2
+ ; CHECK: sub nuw i8 %op1, %op2
+ sub nsw i8 %op1, %op2
+ ; CHECK: sub nsw i8 %op1, %op2
+ sub nuw nsw i8 %op1, %op2
+ ; CHECK: sub nuw nsw i8 %op1, %op2
+ mul i8 %op1, %op2
+ ; CHECK: mul i8 %op1, %op2
+ mul nuw i8 %op1, %op2
+ ; CHECK: mul nuw i8 %op1, %op2
+ mul nsw i8 %op1, %op2
+ ; CHECK: mul nsw i8 %op1, %op2
+ mul nuw nsw i8 %op1, %op2
+ ; CHECK: mul nuw nsw i8 %op1, %op2
+
+ ; exact
+ udiv i8 %op1, %op2
+ ; CHECK: udiv i8 %op1, %op2
+ udiv exact i8 %op1, %op2
+ ; CHECK: udiv exact i8 %op1, %op2
+ sdiv i8 %op1, %op2
+ ; CHECK: sdiv i8 %op1, %op2
+ sdiv exact i8 %op1, %op2
+ ; CHECK: sdiv exact i8 %op1, %op2
+
+ ; none
+ urem i8 %op1, %op2
+ ; CHECK: urem i8 %op1, %op2
+ srem i8 %op1, %op2
+ ; CHECK: srem i8 %op1, %op2
+
+ ret void
+}
+
+; Instructions -- Bitwise Binary Operations
+define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
+ ; nuw x nsw
+ shl i8 %op1, %op2
+ ; CHECK: shl i8 %op1, %op2
+ shl nuw i8 %op1, %op2
+ ; CHECK: shl nuw i8 %op1, %op2
+ shl nsw i8 %op1, %op2
+ ; CHECK: shl nsw i8 %op1, %op2
+ shl nuw nsw i8 %op1, %op2
+ ; CHECK: shl nuw nsw i8 %op1, %op2
+
+ ; exact
+ lshr i8 %op1, %op2
+ ; CHECK: lshr i8 %op1, %op2
+ lshr exact i8 %op1, %op2
+ ; CHECK: lshr exact i8 %op1, %op2
+ ashr i8 %op1, %op2
+ ; CHECK: ashr i8 %op1, %op2
+ ashr exact i8 %op1, %op2
+ ; CHECK: ashr exact i8 %op1, %op2
+
+ ; none
+ and i8 %op1, %op2
+ ; CHECK: and i8 %op1, %op2
+ or i8 %op1, %op2
+ ; CHECK: or i8 %op1, %op2
+ xor i8 %op1, %op2
+ ; CHECK: xor i8 %op1, %op2
+
+ ret void
+}
+
+; Instructions -- Vector Operations
+define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
+ extractelement <4 x float> %vec, i8 0
+ ; CHECK: extractelement <4 x float> %vec, i8 0
+ insertelement <4 x float> %vec, float 3.500000e+00, i8 0
+ ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
+ shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
+ ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
+
+ ret void
+}
+
+; Instructions -- Aggregate Operations
+define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
+ [3 x i8] %arr, { i8, { i32 }} %n,
+ <2 x i8*> %pvec, <2 x i64> %offsets) {
+ extractvalue { i8, i32 } %up, 0
+ ; CHECK: extractvalue { i8, i32 } %up, 0
+ extractvalue <{ i8, i32 }> %p, 1
+ ; CHECK: extractvalue <{ i8, i32 }> %p, 1
+ extractvalue [3 x i8] %arr, 2
+ ; CHECK: extractvalue [3 x i8] %arr, 2
+ extractvalue { i8, { i32 } } %n, 1, 0
+ ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
+
+ insertvalue { i8, i32 } %up, i8 1, 0
+ ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
+ insertvalue <{ i8, i32 }> %p, i32 2, 1
+ ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
+ insertvalue [3 x i8] %arr, i8 0, 0
+ ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
+ insertvalue { i8, { i32 } } %n, i32 0, 1, 0
+ ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
+
+ %up.ptr = alloca { i8, i32 }
+ %p.ptr = alloca <{ i8, i32 }>
+ %arr.ptr = alloca [3 x i8]
+ %n.ptr = alloca { i8, { i32 } }
+
+ getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
+ ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
+ getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
+ ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
+ getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
+ ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
+ getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
+ ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
+ getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
+ ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
+ getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
+ ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
+
+ ret void
+}
+
+; Instructions -- Memory Access and Addressing Operations
+!7 = !{i32 1}
+!8 = !{}
+!9 = !{i64 4}
+define void @instructions.memops(i32** %base) {
+ alloca i32, i8 4, align 4
+ ; CHECK: alloca i32, i8 4, align 4
+ alloca inalloca i32, i8 4, align 4
+ ; CHECK: alloca inalloca i32, i8 4, align 4
+
+ load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
+ ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
+ load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
+ ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9
+
+ store i32* null, i32** %base, align 4, !nontemporal !8
+ ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
+ store volatile i32* null, i32** %base, align 4, !nontemporal !8
+ ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
+
+ ret void
+}
+
+; Instructions -- Conversion Operations
+define void @instructions.conversions() {
+ trunc i32 -1 to i1
+ ; CHECK: trunc i32 -1 to i1
+ zext i32 -1 to i64
+ ; CHECK: zext i32 -1 to i64
+ sext i32 -1 to i64
+ ; CHECK: sext i32 -1 to i64
+ fptrunc float undef to half
+ ; CHECK: fptrunc float undef to half
+ fpext half undef to float
+ ; CHECK: fpext half undef to float
+ fptoui float undef to i32
+ ; CHECK: fptoui float undef to i32
+ fptosi float undef to i32
+ ; CHECK: fptosi float undef to i32
+ uitofp i32 1 to float
+ ; CHECK: uitofp i32 1 to float
+ sitofp i32 -1 to float
+ ; CHECK: sitofp i32 -1 to float
+ ptrtoint i8* null to i64
+ ; CHECK: ptrtoint i8* null to i64
+ inttoptr i64 0 to i8*
+ ; CHECK: inttoptr i64 0 to i8*
+ bitcast i32 0 to i32
+ ; CHECK: bitcast i32 0 to i32
+ addrspacecast i32* null to i32 addrspace(1)*
+ ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
+
+ ret void
+}
+
+; Instructions -- Other Operations
+define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
+entry:
+ icmp eq i32 %op1, %op2
+ ; CHECK: icmp eq i32 %op1, %op2
+ icmp ne i32 %op1, %op2
+ ; CHECK: icmp ne i32 %op1, %op2
+ icmp ugt i32 %op1, %op2
+ ; CHECK: icmp ugt i32 %op1, %op2
+ icmp uge i32 %op1, %op2
+ ; CHECK: icmp uge i32 %op1, %op2
+ icmp ult i32 %op1, %op2
+ ; CHECK: icmp ult i32 %op1, %op2
+ icmp ule i32 %op1, %op2
+ ; CHECK: icmp ule i32 %op1, %op2
+ icmp sgt i32 %op1, %op2
+ ; CHECK: icmp sgt i32 %op1, %op2
+ icmp sge i32 %op1, %op2
+ ; CHECK: icmp sge i32 %op1, %op2
+ icmp slt i32 %op1, %op2
+ ; CHECK: icmp slt i32 %op1, %op2
+ icmp sle i32 %op1, %op2
+ ; CHECK: icmp sle i32 %op1, %op2
+
+ fcmp false half %fop1, %fop2
+ ; CHECK: fcmp false half %fop1, %fop2
+ fcmp oeq half %fop1, %fop2
+ ; CHECK: fcmp oeq half %fop1, %fop2
+ fcmp ogt half %fop1, %fop2
+ ; CHECK: fcmp ogt half %fop1, %fop2
+ fcmp oge half %fop1, %fop2
+ ; CHECK: fcmp oge half %fop1, %fop2
+ fcmp olt half %fop1, %fop2
+ ; CHECK: fcmp olt half %fop1, %fop2
+ fcmp ole half %fop1, %fop2
+ ; CHECK: fcmp ole half %fop1, %fop2
+ fcmp one half %fop1, %fop2
+ ; CHECK: fcmp one half %fop1, %fop2
+ fcmp ord half %fop1, %fop2
+ ; CHECK: fcmp ord half %fop1, %fop2
+ fcmp ueq half %fop1, %fop2
+ ; CHECK: fcmp ueq half %fop1, %fop2
+ fcmp ugt half %fop1, %fop2
+ ; CHECK: fcmp ugt half %fop1, %fop2
+ fcmp uge half %fop1, %fop2
+ ; CHECK: fcmp uge half %fop1, %fop2
+ fcmp ult half %fop1, %fop2
+ ; CHECK: fcmp ult half %fop1, %fop2
+ fcmp ule half %fop1, %fop2
+ ; CHECK: fcmp ule half %fop1, %fop2
+ fcmp une half %fop1, %fop2
+ ; CHECK: fcmp une half %fop1, %fop2
+ fcmp uno half %fop1, %fop2
+ ; CHECK: fcmp uno half %fop1, %fop2
+ fcmp true half %fop1, %fop2
+ ; CHECK: fcmp true half %fop1, %fop2
+
+ br label %exit
+L1:
+ %v1 = add i32 %op1, %op2
+ br label %exit
+L2:
+ %v2 = add i32 %op1, %op2
+ br label %exit
+exit:
+ phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
+ ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
+
+ select i1 true, i32 0, i32 1
+ ; CHECK: select i1 true, i32 0, i32 1
+ select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
+ ; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
+
+ call void @f.nobuiltin() builtin
+ ; CHECK: call void @f.nobuiltin() #39
+
+ call fastcc noalias i32* @f.noalias() noinline
+ ; CHECK: call fastcc noalias i32* @f.noalias() #12
+ tail call ghccc nonnull i32* @f.nonnull() minsize
+ ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #7
+
+ ret void
+}
+
+define void @instructions.call_musttail(i8* inalloca %val) {
+ musttail call void @f.param.inalloca(i8* inalloca %val)
+ ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
+
+ ret void
+}
+
+define void @instructions.call_notail() {
+ notail call void @f1()
+ ; CHECK: notail call void @f1()
+
+ ret void
+}
+
+define void @instructions.landingpad() personality i32 -2 {
+ invoke void @llvm.donothing() to label %proceed unwind label %catch1
+ invoke void @llvm.donothing() to label %proceed unwind label %catch2
+ invoke void @llvm.donothing() to label %proceed unwind label %catch3
+ invoke void @llvm.donothing() to label %proceed unwind label %catch4
+
+catch1:
+ landingpad i32
+ ; CHECK: landingpad i32
+ cleanup
+ ; CHECK: cleanup
+ br label %proceed
+
+catch2:
+ landingpad i32
+ ; CHECK: landingpad i32
+ cleanup
+ ; CHECK: cleanup
+ catch i32* null
+ ; CHECK: catch i32* null
+ br label %proceed
+
+catch3:
+ landingpad i32
+ ; CHECK: landingpad i32
+ cleanup
+ ; CHECK: cleanup
+ catch i32* null
+ ; CHECK: catch i32* null
+ catch i32* null
+ ; CHECK: catch i32* null
+ br label %proceed
+
+catch4:
+ landingpad i32
+ ; CHECK: landingpad i32
+ filter [2 x i32] zeroinitializer
+ ; CHECK: filter [2 x i32] zeroinitializer
+ br label %proceed
+
+proceed:
+ ret void
+}
+
+;; Intrinsic Functions
+
+; Intrinsic Functions -- Variable Argument Handling
+declare void @llvm.va_start(i8*)
+declare void @llvm.va_copy(i8*, i8*)
+declare void @llvm.va_end(i8*)
+define void @instructions.va_arg(i8* %v, ...) {
+ %ap = alloca i8*
+ %ap2 = bitcast i8** %ap to i8*
+
+ call void @llvm.va_start(i8* %ap2)
+ ; CHECK: call void @llvm.va_start(i8* %ap2)
+
+ va_arg i8* %ap2, i32
+ ; CHECK: va_arg i8* %ap2, i32
+
+ call void @llvm.va_copy(i8* %v, i8* %ap2)
+ ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
+
+ call void @llvm.va_end(i8* %ap2)
+ ; CHECK: call void @llvm.va_end(i8* %ap2)
+
+ ret void
+}
+
+; Intrinsic Functions -- Accurate Garbage Collection
+declare void @llvm.gcroot(i8**, i8*)
+declare i8* @llvm.gcread(i8*, i8**)
+declare void @llvm.gcwrite(i8*, i8*, i8**)
+define void @intrinsics.gc() gc "shadow-stack" {
+ %ptrloc = alloca i8*
+ call void @llvm.gcroot(i8** %ptrloc, i8* null)
+ ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
+
+ call i8* @llvm.gcread(i8* null, i8** %ptrloc)
+ ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
+
+ %ref = alloca i8
+ call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
+ ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
+
+ ret void
+}
+
+; Intrinsic Functions -- Code Generation
+declare i8* @llvm.returnaddress(i32)
+declare i8* @llvm.frameaddress(i32)
+declare i32 @llvm.read_register.i32(metadata)
+declare i64 @llvm.read_register.i64(metadata)
+declare void @llvm.write_register.i32(metadata, i32)
+declare void @llvm.write_register.i64(metadata, i64)
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8*)
+declare void @llvm.prefetch(i8*, i32, i32, i32)
+declare void @llvm.pcmarker(i32)
+declare i64 @llvm.readcyclecounter()
+declare void @llvm.clear_cache(i8*, i8*)
+declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
+
+!10 = !{!"rax"}
+define void @intrinsics.codegen() {
+ call i8* @llvm.returnaddress(i32 1)
+ ; CHECK: call i8* @llvm.returnaddress(i32 1)
+ call i8* @llvm.frameaddress(i32 1)
+ ; CHECK: call i8* @llvm.frameaddress(i32 1)
+
+ call i32 @llvm.read_register.i32(metadata !10)
+ ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
+ call i64 @llvm.read_register.i64(metadata !10)
+ ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
+ call void @llvm.write_register.i32(metadata !10, i32 0)
+ ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
+ call void @llvm.write_register.i64(metadata !10, i64 0)
+ ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
+
+ %stack = call i8* @llvm.stacksave()
+ ; CHECK: %stack = call i8* @llvm.stacksave()
+ call void @llvm.stackrestore(i8* %stack)
+ ; CHECK: call void @llvm.stackrestore(i8* %stack)
+
+ call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
+ ; CHECK: call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
+
+ call void @llvm.pcmarker(i32 1)
+ ; CHECK: call void @llvm.pcmarker(i32 1)
+
+ call i64 @llvm.readcyclecounter()
+ ; CHECK: call i64 @llvm.readcyclecounter()
+
+ call void @llvm.clear_cache(i8* null, i8* null)
+ ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
+
+ call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
+ ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
+
+ ret void
+}
+
+declare void @llvm.localescape(...)
+declare i8* @llvm.localrecover(i8* %func, i8* %fp, i32 %idx)
+define void @intrinsics.localescape() {
+ %static.alloca = alloca i32
+ call void (...) @llvm.localescape(i32* %static.alloca)
+ ; CHECK: call void (...) @llvm.localescape(i32* %static.alloca)
+
+ call void @intrinsics.localrecover()
+
+ ret void
+}
+define void @intrinsics.localrecover() {
+ %func = bitcast void ()* @intrinsics.localescape to i8*
+ %fp = call i8* @llvm.frameaddress(i32 1)
+ call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
+ ; CHECK: call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0)
+
+ ret void
+}
+
+; We need this function to provide `uses' for some metadata tests.
+define void @misc.metadata() {
+ call void @f1(), !srcloc !11
+ call void @f1(), !srcloc !12
+ call void @f1(), !srcloc !13
+ call void @f1(), !srcloc !14
+ ret void
+}
+
+declare void @op_bundle_callee_0()
+declare void @op_bundle_callee_1(i32,i32)
+
+define void @call_with_operand_bundle0(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle0(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+ ret void
+}
+
+define void @call_with_operand_bundle1(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle1(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+
+ call void @op_bundle_callee_0()
+ call void @op_bundle_callee_0() [ "foo"() ]
+ call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+; CHECK: @op_bundle_callee_0(){{$}}
+; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"() ]
+; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+ ret void
+}
+
+define void @call_with_operand_bundle2(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle2(
+ entry:
+ call void @op_bundle_callee_0() [ "foo"() ]
+; CHECK: call void @op_bundle_callee_0() [ "foo"() ]
+ ret void
+}
+
+define void @call_with_operand_bundle3(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle3(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+ ret void
+}
+
+define void @call_with_operand_bundle4(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle4(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+; CHECK: call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+ ret void
+}
+
+; Invoke versions of the above tests:
+
+
+define void @invoke_with_operand_bundle0(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle0(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+define void @invoke_with_operand_bundle1(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle1(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+
+ invoke void @op_bundle_callee_0() to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_0(){{$}}
+
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+
+normal:
+ invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal1 unwind label %exception1
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
+
+exception1:
+ %cleanup1 = landingpad i8 cleanup
+ br label %normal1
+
+normal1:
+ invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal2 unwind label %exception2
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+
+exception2:
+ %cleanup2 = landingpad i8 cleanup
+ br label %normal2
+
+normal2:
+ ret void
+}
+
+define void @invoke_with_operand_bundle2(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle2(
+ entry:
+ invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
+
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+define void @invoke_with_operand_bundle3(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle3(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+define void @invoke_with_operand_bundle4(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle4(
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+ to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
+
+exception:
+ %cleanup = landingpad i8 cleanup
+ br label %normal
+normal:
+ ret void
+}
+
+
+; CHECK: attributes #0 = { alignstack=4 }
+; CHECK: attributes #1 = { alignstack=8 }
+; CHECK: attributes #2 = { alwaysinline }
+; CHECK: attributes #3 = { cold }
+; CHECK: attributes #4 = { convergent }
+; CHECK: attributes #5 = { inlinehint }
+; CHECK: attributes #6 = { jumptable }
+; CHECK: attributes #7 = { minsize }
+; CHECK: attributes #8 = { naked }
+; CHECK: attributes #9 = { nobuiltin }
+; CHECK: attributes #10 = { noduplicate }
+; CHECK: attributes #11 = { noimplicitfloat }
+; CHECK: attributes #12 = { noinline }
+; CHECK: attributes #13 = { nonlazybind }
+; CHECK: attributes #14 = { noredzone }
+; CHECK: attributes #15 = { noreturn }
+; CHECK: attributes #16 = { nounwind }
+; CHECK: attributes #17 = { noinline optnone }
+; CHECK: attributes #18 = { optsize }
+; CHECK: attributes #19 = { readnone }
+; CHECK: attributes #20 = { readonly }
+; CHECK: attributes #21 = { returns_twice }
+; CHECK: attributes #22 = { safestack }
+; CHECK: attributes #23 = { sanitize_address }
+; CHECK: attributes #24 = { sanitize_memory }
+; CHECK: attributes #25 = { sanitize_thread }
+; CHECK: attributes #26 = { ssp }
+; CHECK: attributes #27 = { sspreq }
+; CHECK: attributes #28 = { sspstrong }
+; CHECK: attributes #29 = { "thunk" }
+; CHECK: attributes #30 = { uwtable }
+; CHECK: attributes #31 = { "cpu"="cortex-a8" }
+; CHECK: attributes #32 = { norecurse }
+; CHECK: attributes #33 = { inaccessiblememonly }
+; CHECK: attributes #34 = { inaccessiblemem_or_argmemonly }
+; CHECK: attributes #35 = { nounwind readnone }
+; CHECK: attributes #36 = { argmemonly nounwind readonly }
+; CHECK: attributes #37 = { argmemonly nounwind }
+; CHECK: attributes #38 = { nounwind readonly }
+; CHECK: attributes #39 = { builtin }
+
+;; Metadata
+
+; Metadata -- Module flags
+!llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
+; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
+
+!0 = !{i32 1, !"mod1", i32 0}
+; CHECK: !0 = !{i32 1, !"mod1", i32 0}
+!1 = !{i32 2, !"mod2", i32 0}
+; CHECK: !1 = !{i32 2, !"mod2", i32 0}
+!2 = !{i32 3, !"mod3", !3}
+; CHECK: !2 = !{i32 3, !"mod3", !3}
+!3 = !{!"mod6", !0}
+; CHECK: !3 = !{!"mod6", !0}
+!4 = !{i32 4, !"mod4", i32 0}
+; CHECK: !4 = !{i32 4, !"mod4", i32 0}
+!5 = !{i32 5, !"mod5", !0}
+; CHECK: !5 = !{i32 5, !"mod5", !0}
+!6 = !{i32 6, !"mod6", !0}
+; CHECK: !6 = !{i32 6, !"mod6", !0}
+
+; Metadata -- Check `distinct'
+!11 = distinct !{}
+; CHECK: !11 = distinct !{}
+!12 = distinct !{}
+; CHECK: !12 = distinct !{}
+!13 = !{!11}
+; CHECK: !13 = !{!11}
+!14 = !{!12}
+; CHECK: !14 = !{!12}
diff --git a/test/Bitcode/compatibility-3.8.ll.bc b/test/Bitcode/compatibility-3.8.ll.bc
new file mode 100644
index 0000000000000..3894b37890f3f
--- /dev/null
+++ b/test/Bitcode/compatibility-3.8.ll.bc
Binary files differ
diff --git a/test/Bitcode/compatibility.ll b/test/Bitcode/compatibility.ll
index ae12a24ede4b7..18270607c3cb9 100644
--- a/test/Bitcode/compatibility.ll
+++ b/test/Bitcode/compatibility.ll
@@ -80,7 +80,7 @@ $comdat.samesize = comdat samesize
;; Global Variables
; Format: [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass]
-; [ThreadLocal] [unnamed_addr] [AddrSpace] [ExternallyInitialized]
+; [ThreadLocal] [(unnamed_addr|local_unnamed_addr)] [AddrSpace] [ExternallyInitialized]
; <global | constant> <Type> [<InitializerConstant>]
; [, section "name"] [, comdat [($name)]] [, align <Alignment>]
@@ -142,9 +142,11 @@ $comdat.samesize = comdat samesize
@g.localexec = thread_local(localexec) global i32 0
; CHECK: @g.localexec = thread_local(localexec) global i32 0
-; Global Variables -- unnamed_addr
+; Global Variables -- unnamed_addr and local_unnamed_addr
@g.unnamed_addr = unnamed_addr global i32 0
; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
+@g.local_unnamed_addr = local_unnamed_addr global i32 0
+; CHECK: @g.local_unnamed_addr = local_unnamed_addr global i32 0
; Global Variables -- AddrSpace
@g.addrspace = addrspace(1) global i32 0
@@ -245,15 +247,42 @@ declare void @g.f1()
@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
-; Aliases -- unnamed_addr
+; Aliases -- unnamed_addr and local_unnamed_addr
@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
+@a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
+; CHECK: @a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr
+
+;; IFunc
+; Format @<Name> = [Linkage] [Visibility] ifunc <IFuncTy>,
+; <ResolverTy>* @<Resolver>
+
+; IFunc -- Linkage
+@ifunc.external = external ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.external = ifunc void (), i8* ()* @ifunc_resolver
+@ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver
+@ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver
+
+; IFunc -- Visibility
+@ifunc.default = default ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.default = ifunc void (), i8* ()* @ifunc_resolver
+@ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver
+@ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
+; CHECK: @ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver
+
+define i8* @ifunc_resolver() {
+entry:
+ ret i8* null
+}
;; Functions
; Format: define [linkage] [visibility] [DLLStorageClass]
; [cconv] [ret attrs]
; <ResultType> @<FunctionName> ([argument list])
-; [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
+; [(unnamed_addr|local_unnamed_addr)] [fn Attrs] [section "name"] [comdat [($name)]]
; [align N] [gc] [prefix Constant] [prologue Constant]
; [personality Constant] { ... }
@@ -403,6 +432,46 @@ declare cc80 void @f.cc80()
; CHECK: declare x86_vectorcallcc void @f.cc80()
declare x86_vectorcallcc void @f.x86_vectorcallcc()
; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
+declare cc81 void @f.cc81()
+; CHECK: declare hhvmcc void @f.cc81()
+declare hhvmcc void @f.hhvmcc()
+; CHECK: declare hhvmcc void @f.hhvmcc()
+declare cc82 void @f.cc82()
+; CHECK: declare hhvm_ccc void @f.cc82()
+declare hhvm_ccc void @f.hhvm_ccc()
+; CHECK: declare hhvm_ccc void @f.hhvm_ccc()
+declare cc83 void @f.cc83()
+; CHECK: declare x86_intrcc void @f.cc83()
+declare x86_intrcc void @f.x86_intrcc()
+; CHECK: declare x86_intrcc void @f.x86_intrcc()
+declare cc84 void @f.cc84()
+; CHECK: declare avr_intrcc void @f.cc84()
+declare avr_intrcc void @f.avr_intrcc()
+; CHECK: declare avr_intrcc void @f.avr_intrcc()
+declare cc85 void @f.cc85()
+; CHECK: declare avr_signalcc void @f.cc85()
+declare avr_signalcc void @f.avr_signalcc()
+; CHECK: declare avr_signalcc void @f.avr_signalcc()
+declare cc87 void @f.cc87()
+; CHECK: declare amdgpu_vs void @f.cc87()
+declare amdgpu_vs void @f.amdgpu_vs()
+; CHECK: declare amdgpu_vs void @f.amdgpu_vs()
+declare cc88 void @f.cc88()
+; CHECK: declare amdgpu_gs void @f.cc88()
+declare amdgpu_gs void @f.amdgpu_gs()
+; CHECK: declare amdgpu_gs void @f.amdgpu_gs()
+declare cc89 void @f.cc89()
+; CHECK: declare amdgpu_ps void @f.cc89()
+declare amdgpu_ps void @f.amdgpu_ps()
+; CHECK: declare amdgpu_ps void @f.amdgpu_ps()
+declare cc90 void @f.cc90()
+; CHECK: declare amdgpu_cs void @f.cc90()
+declare amdgpu_cs void @f.amdgpu_cs()
+; CHECK: declare amdgpu_cs void @f.amdgpu_cs()
+declare cc91 void @f.cc91()
+; CHECK: declare amdgpu_kernel void @f.cc91()
+declare amdgpu_kernel void @f.amdgpu_kernel()
+; CHECK: declare amdgpu_kernel void @f.amdgpu_kernel()
declare cc1023 void @f.cc1023()
; CHECK: declare cc1023 void @f.cc1023()
@@ -458,9 +527,11 @@ declare void @f.param.dereferenceable(i8* dereferenceable(4))
declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4))
-; Functions -- unnamed_addr
+; Functions -- unnamed_addr and local_unnamed_addr
declare void @f.unnamed_addr() unnamed_addr
; CHECK: declare void @f.unnamed_addr() unnamed_addr
+declare void @f.local_unnamed_addr() local_unnamed_addr
+; CHECK: declare void @f.local_unnamed_addr() local_unnamed_addr
; Functions -- fn Attrs (Function attributes)
declare void @f.alignstack4() alignstack(4)
@@ -1173,7 +1244,7 @@ exit:
; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
call void @f.nobuiltin() builtin
- ; CHECK: call void @f.nobuiltin() #39
+ ; CHECK: call void @f.nobuiltin() #40
call fastcc noalias i32* @f.noalias() noinline
; CHECK: call fastcc noalias i32* @f.noalias() #12
@@ -1519,6 +1590,8 @@ normal:
ret void
}
+declare void @f.writeonly() writeonly
+; CHECK: declare void @f.writeonly() #39
; CHECK: attributes #0 = { alignstack=4 }
; CHECK: attributes #1 = { alignstack=8 }
@@ -1559,7 +1632,8 @@ normal:
; CHECK: attributes #36 = { argmemonly nounwind readonly }
; CHECK: attributes #37 = { argmemonly nounwind }
; CHECK: attributes #38 = { nounwind readonly }
-; CHECK: attributes #39 = { builtin }
+; CHECK: attributes #39 = { writeonly }
+; CHECK: attributes #40 = { builtin }
;; Metadata
diff --git a/test/Bitcode/debug-loc-again.ll b/test/Bitcode/debug-loc-again.ll
index adf74a07ebed6..3bfbd1ff30b38 100644
--- a/test/Bitcode/debug-loc-again.ll
+++ b/test/Bitcode/debug-loc-again.ll
@@ -27,10 +27,10 @@ entry:
; CHECK: ![[LINE2]] = !DILocation(line: 2,
!llvm.module.flags = !{!0}
+!llvm.dbg.cu = !{!1}
!0 = !{i32 2, !"Debug Info Version", i32 3}
-!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !DIFile(filename: "f", directory: "/d"),
- subprograms: !{!2})
-!2 = distinct !DISubprogram(name: "foo")
+!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !DIFile(filename: "f", directory: "/d"))
+!2 = distinct !DISubprogram(name: "foo", unit: !1)
!3 = !DILocation(line: 1, scope: !2)
!4 = !DILocation(line: 2, scope: !2)
diff --git a/test/Bitcode/dityperefs-3.8.ll b/test/Bitcode/dityperefs-3.8.ll
new file mode 100644
index 0000000000000..6c953f28aba71
--- /dev/null
+++ b/test/Bitcode/dityperefs-3.8.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-dis < %s.bc | FileCheck %s
+; RUN: verify-uselistorder %s.bc
+
+; Establish a stable order.
+!named = !{!0, !1, !2, !3, !4, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16}
+
+; CHECK: !0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
+; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "T1"{{.*}}, identifier: "T1")
+; CHECK-NEXT: !2 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", scope: !1{{.*}}, baseType: !1, vtableHolder: !1, identifier: "T2")
+; CHECK-NEXT: !3 = !DIDerivedType(tag: DW_TAG_member, name: "M1", scope: !1{{.*}}, baseType: !2)
+; CHECK-NEXT: !4 = !DISubroutineType(types: !5)
+; CHECK-NEXT: !5 = !{!1, !2}
+; CHECK-NEXT: !6 = !DISubprogram(scope: !1,{{.*}} containingType: !1{{[,)]}}
+; CHECK-NEXT: !7 = !DILocalVariable(name: "V1", scope: !6, type: !2)
+; CHECK-NEXT: !8 = !DIObjCProperty(name: "P1", type: !1)
+; CHECK-NEXT: !9 = !DITemplateTypeParameter(type: !1)
+; CHECK-NEXT: !10 = !DIGlobalVariable(name: "G",{{.*}} type: !1,{{.*}} variable: i32* @G1)
+; CHECK-NEXT: !11 = !DITemplateValueParameter(type: !1, value: i32* @G1)
+; CHECK-NEXT: !12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !0, entity: !1)
+; CHECK-NEXT: !13 = !DICompositeType(tag: DW_TAG_structure_type, name: "T3", file: !0, elements: !14, identifier: "T3")
+; CHECK-NEXT: !14 = !{!15}
+; CHECK-NEXT: !15 = !DISubprogram(scope: !13,
+; CHECK-NEXT: !16 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type,{{.*}} extraData: !13)
+
+!0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
+!1 = !DICompositeType(tag: DW_TAG_structure_type, name: "T1", file: !0, identifier: "T1")
+!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", file: !0, scope: !"T1", baseType: !"T1", vtableHolder: !"T1", identifier: "T2")
+!3 = !DIDerivedType(tag: DW_TAG_member, name: "M1", file: !0, scope: !"T1", baseType: !"T2")
+!4 = !DISubroutineType(types: !5)
+!5 = !{!"T1", !"T2"}
+!6 = !DISubprogram(scope: !"T1", isDefinition: false, containingType: !"T1")
+!7 = !DILocalVariable(name: "V1", scope: !6, type: !"T2")
+!8 = !DIObjCProperty(name: "P1", type: !"T1")
+!9 = !DITemplateTypeParameter(type: !"T1")
+!10 = !DIGlobalVariable(name: "G", type: !"T1", isDefinition: false, variable: i32* @G1)
+!11 = !DITemplateValueParameter(type: !"T1", value: i32* @G1)
+!12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !0, entity: !"T1")
+!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "T3", file: !0, elements: !14, identifier: "T3")
+!14 = !{!15}
+!15 = !DISubprogram(scope: !"T3", isDefinition: false)
+!16 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !4, extraData: !"T3")
+
+@G1 = global i32 0
diff --git a/test/Bitcode/dityperefs-3.8.ll.bc b/test/Bitcode/dityperefs-3.8.ll.bc
new file mode 100644
index 0000000000000..4ec0bca70fa4d
--- /dev/null
+++ b/test/Bitcode/dityperefs-3.8.ll.bc
Binary files differ
diff --git a/test/Bitcode/invalid.ll b/test/Bitcode/invalid.ll
index c56f0ffefa9e6..4bbb4570f7e70 100644
--- a/test/Bitcode/invalid.ll
+++ b/test/Bitcode/invalid.ll
@@ -1,6 +1,6 @@
; RUN: not llvm-dis < %s.bc 2>&1 | FileCheck %s
-; CHECK: llvm-dis{{(\.EXE|\.exe)?}}: error: Unknown attribute kind (52)
+; CHECK: llvm-dis{{(\.EXE|\.exe)?}}: error: Unknown attribute kind (63)
; invalid.ll.bc has an invalid attribute number.
; The test checks that LLVM reports the error and doesn't access freed memory
diff --git a/test/Bitcode/invalid.ll.bc b/test/Bitcode/invalid.ll.bc
index 60c7afffbc230..a2b611e6c516c 100644
--- a/test/Bitcode/invalid.ll.bc
+++ b/test/Bitcode/invalid.ll.bc
Binary files differ
diff --git a/test/Bitcode/invalid.test b/test/Bitcode/invalid.test
index 3425adc841003..e7e78b3af5aca 100644
--- a/test/Bitcode/invalid.test
+++ b/test/Bitcode/invalid.test
@@ -168,11 +168,6 @@ RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
INVALID-ARGUMENT-TYPE: Invalid function argument type
-RUN: not llvm-dis -disable-output %p/Inputs/invalid-fixme-streaming-blob.bc 2>&1 | \
-RUN: FileCheck --check-prefix=STREAMING-BLOB %s
-
-STREAMING-BLOB: getPointer in streaming memory objects not allowed
-
RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-comdat-id.bc 2>&1 | \
RUN: FileCheck --check-prefix=INVALID-FCOMDAT-ID %s
@@ -217,3 +212,23 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-name-with-0-byte.bc 2>&1 | \
RUN: FileCheck --check-prefix=NAME-WITH-0 %s
NAME-WITH-0: Invalid value name
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-void-constant.bc 2>&1 | \
+RUN: FileCheck --check-prefix=VOID-CONSTANT-TYPE %s
+
+VOID-CONSTANT-TYPE: Invalid constant type
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-no-operands.bc 2>&1 | \
+RUN: FileCheck --check-prefix=GEP-NO-OPERANDS %s
+
+GEP-NO-OPERANDS: Invalid gep with no operands
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>&1 | \
+RUN: FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
+
+NONPOINTER-STOREATOMIC: Invalid record
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 | \
+RUN: FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s
+
+NONPOINTER-ATOMICRMW: Invalid record
diff --git a/test/Bitcode/mdnodes-distinct-in-post-order.ll b/test/Bitcode/mdnodes-distinct-in-post-order.ll
new file mode 100644
index 0000000000000..6e6ba604235b9
--- /dev/null
+++ b/test/Bitcode/mdnodes-distinct-in-post-order.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s
+; Check that distinct nodes are emitted in post-order to avoid unnecessary
+; forward references.
+
+; Nodes in this testcase are numbered to match how they are referenced in
+; bitcode. !3 is referenced as opN=3.
+
+; The leafs should come first (in either order).
+; CHECK: <DISTINCT_NODE/>
+; CHECK-NEXT: <DISTINCT_NODE/>
+!1 = distinct !{}
+!2 = distinct !{}
+
+; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=2/>
+!3 = distinct !{!1, !2}
+
+; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=3 op2=2/>
+!4 = distinct !{!1, !3, !2}
+
+; Note: named metadata nodes are not cannot reference null so their operands
+; are numbered off-by-one.
+; CHECK-NEXT: <NAME
+; CHECK-NEXT: <NAMED_NODE op0=3/>
+!named = !{!4}
diff --git a/test/Bitcode/mdnodes-distinct-nodes-break-cycles.ll b/test/Bitcode/mdnodes-distinct-nodes-break-cycles.ll
new file mode 100644
index 0000000000000..51701d10c03bf
--- /dev/null
+++ b/test/Bitcode/mdnodes-distinct-nodes-break-cycles.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s
+; Check that distinct nodes break uniquing cycles, so that uniqued subgraphs
+; are always in post-order.
+;
+; It may not be immediately obvious why this is an interesting graph. There
+; are three nodes in a cycle, and one of them (!1) is distinct. Because the
+; entry point is !2, a naive post-order traversal would give !3, !1, !2; but
+; this means when !3 is parsed the reader will need a forward reference for !2.
+; Forward references for uniqued node operands are expensive, whereas they're
+; cheap for distinct node operands. If the distinct node is emitted first, the
+; uniqued nodes don't need any forward references at all.
+
+; Nodes in this testcase are numbered to match how they are referenced in
+; bitcode. !3 is referenced as opN=3.
+
+; CHECK: <DISTINCT_NODE op0=3/>
+!1 = distinct !{!3}
+
+; CHECK-NEXT: <NODE op0=1/>
+!2 = !{!1}
+
+; CHECK-NEXT: <NODE op0=2/>
+!3 = !{!2}
+
+; Note: named metadata nodes are not cannot reference null so their operands
+; are numbered off-by-one.
+; CHECK-NEXT: <NAME
+; CHECK-NEXT: <NAMED_NODE op0=1/>
+!named = !{!2}
diff --git a/test/Bitcode/mdnodes-distinct-nodes-first.ll b/test/Bitcode/mdnodes-distinct-nodes-first.ll
new file mode 100644
index 0000000000000..1d146817e6b03
--- /dev/null
+++ b/test/Bitcode/mdnodes-distinct-nodes-first.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s
+; Check that distinct nodes are emitted before uniqued nodes, even if that
+; breaks post-order traversals.
+
+; Nodes in this testcase are numbered to match how they are referenced in
+; bitcode. !1 is referenced as opN=1.
+
+; CHECK: <DISTINCT_NODE op0=2/>
+!1 = distinct !{!2}
+
+; CHECK-NEXT: <NODE op0=1/>
+!2 = !{!1}
+
+; Note: named metadata nodes are not cannot reference null so their operands
+; are numbered off-by-one.
+; CHECK-NEXT: <NAME
+; CHECK-NEXT: <NAMED_NODE op0=1/>
+!named = !{!2}
diff --git a/test/Bitcode/mdnodes-in-post-order.ll b/test/Bitcode/mdnodes-in-post-order.ll
new file mode 100644
index 0000000000000..fbe1c34cf00aa
--- /dev/null
+++ b/test/Bitcode/mdnodes-in-post-order.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s
+; Check that nodes are emitted in post-order to minimize the need for temporary
+; nodes. The graph structure is designed to foil naive implementations of
+; iteratitive post-order traersals: the leaves, !3 and !4, are reachable from
+; the entry node, !6, as well as from !5. There is one leaf on either side to
+; be sure it tickles bugs whether operands are visited forward or reverse.
+
+; Nodes in this testcase are numbered to match how they are referenced in
+; bitcode. !3 is referenced as opN=3.
+
+; We don't care about the order of the strings (or of !3 and !4). Let's just
+; make sure the strings are first and make it clear that there are two of them.
+; CHECK: <STRINGS {{.*}} num-strings = 2 {
+; CHECK-NEXT: 'leaf
+; CHECK-NEXT: 'leaf
+; CHECK-NEXT: }
+
+; The leafs should come first (in either order).
+; CHECK-NEXT: <NODE op0=1/>
+; CHECK-NEXT: <NODE op0=2/>
+!3 = !{!"leaf3"}
+!4 = !{!"leaf4"}
+
+; CHECK-NEXT: <NODE op0=3 op1=4/>
+!5 = !{!3, !4}
+
+; CHECK-NEXT: <NODE op0=3 op1=5 op2=4/>
+!6 = !{!3, !5, !4}
+
+; Note: named metadata nodes are not cannot reference null so their operands
+; are numbered off-by-one.
+; CHECK-NEXT: <NAME
+; CHECK-NEXT: <NAMED_NODE op0=5/>
+!named = !{!6}
diff --git a/test/Bitcode/metadata-function-blocks.ll b/test/Bitcode/metadata-function-blocks.ll
new file mode 100644
index 0000000000000..f3e83c5074d17
--- /dev/null
+++ b/test/Bitcode/metadata-function-blocks.ll
@@ -0,0 +1,75 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+; Test that metadata only used by a single function is serialized in that
+; function instead of in the global pool.
+;
+; In order to make the bitcode records easy to follow, nodes in this testcase
+; are named after the ids they are given in the bitcode. Nodes local to a
+; function have offsets of 100 or 200 (depending on the function) so that they
+; remain unique within this textual IR.
+
+; Check for strings in the global pool.
+; CHECK: <METADATA_BLOCK
+; CHECK-NEXT: <STRINGS
+; CHECK-SAME: /> num-strings = 3 {
+; CHECK-NEXT: 'named'
+; CHECK-NEXT: 'named and foo'
+; CHECK-NEXT: 'foo and bar'
+; CHECK-NEXT: }
+
+; Each node gets a new number. Bottom-up traversal of nodes.
+!named = !{!6}
+
+; CHECK-NEXT: <NODE op0=1/>
+!4 = !{!"named"}
+
+; CHECK-NEXT: <NODE op0=2/>
+!5 = !{!"named and foo"}
+
+; CHECK-NEXT: <NODE op0=1 op1=4 op2=5/>
+!6 = !{!"named", !4, !5}
+
+; CHECK-NEXT: <NODE op0=3/>
+!7 = !{!"foo and bar"}
+
+; CHECK-NOT: <NODE
+; CHECK: </METADATA_BLOCK
+
+; Look at metadata local to @foo, starting with strings.
+; CHECK: <FUNCTION_BLOCK
+; CHECK: <METADATA_BLOCK
+; CHECK-NEXT: <STRINGS
+; CHECK-SAME: /> num-strings = 1 {
+; CHECK-NEXT: 'foo'
+; CHECK-NEXT: }
+
+; Function-local nodes start at 9 (strings at 8).
+; CHECK-NEXT: <NODE op0=8/>
+!109 = !{!"foo"}
+
+; CHECK-NEXT: <NODE op0=8 op1=3 op2=9 op3=7 op4=5/>
+!110 = !{!"foo", !"foo and bar", !109, !7, !5}
+
+; CHECK-NEXT: </METADATA_BLOCK
+define void @foo() !foo !110 {
+ unreachable
+}
+
+; Look at metadata local to @bar, starting with strings.
+; CHECK: <FUNCTION_BLOCK
+; CHECK: <METADATA_BLOCK
+; CHECK-NEXT: <STRINGS
+; CHECK-SAME: /> num-strings = 1 {
+; CHECK-NEXT: 'bar'
+; CHECK-NEXT: }
+
+; Function-local nodes start at 9 (strings at 8).
+; CHECK-NEXT: <NODE op0=8/>
+!209 = !{!"bar"}
+
+; CHECK-NEXT: <NODE op0=8 op1=3 op2=9 op3=7/>
+!210 = !{!"bar", !"foo and bar", !209, !7}
+
+; CHECK-NEXT: </METADATA_BLOCK
+define void @bar() {
+ unreachable, !bar !210
+}
diff --git a/test/Bitcode/metadata-only-empty-string.ll b/test/Bitcode/metadata-only-empty-string.ll
new file mode 100644
index 0000000000000..f8331e3598590
--- /dev/null
+++ b/test/Bitcode/metadata-only-empty-string.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+; CHECK: !named = !{!0}
+!named = !{!0}
+
+; CHECK: !0 = !{!""}
+!0 = !{!""}
diff --git a/test/Bitcode/metadata-strings.ll b/test/Bitcode/metadata-strings.ll
new file mode 100644
index 0000000000000..9c48db5b9839d
--- /dev/null
+++ b/test/Bitcode/metadata-strings.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+
+!named = !{!0}
+
+; CHECK: <METADATA_BLOCK
+; CHECK-NEXT: <STRINGS
+; CHECK-SAME: /> num-strings = 3 {
+; CHECK-NEXT: 'a'
+; CHECK-NEXT: 'b'
+; CHECK-NEXT: 'c'
+; CHECK-NEXT: }
+!0 = !{!"a", !"b", !"c"}
diff --git a/test/Bitcode/module_hash.ll b/test/Bitcode/module_hash.ll
new file mode 100644
index 0000000000000..56f3fdc4b7eaa
--- /dev/null
+++ b/test/Bitcode/module_hash.ll
@@ -0,0 +1,35 @@
+; Check per module hash.
+; RUN: opt -module-hash %s -o - | llvm-bcanalyzer -dump | FileCheck %s --check-prefix=MOD1
+; MOD1: <HASH op0={{[0-9]*}} op1={{[0-9]*}} op2={{[0-9]*}} op3={{[0-9]*}} op4={{[0-9]*}} (match)/>
+; RUN: opt -module-hash %p/Inputs/module_hash.ll -o - | llvm-bcanalyzer -dump | FileCheck %s --check-prefix=MOD2
+; MOD2: <HASH op0={{[0-9]*}} op1={{[0-9]*}} op2={{[0-9]*}} op3={{[0-9]*}} op4={{[0-9]*}} (match)/>
+
+; Check that the hash matches in the combined index.
+
+; First regenerate the modules with a summary
+; RUN: opt -module-hash -module-summary %s -o %t.m1.bc
+; RUN: opt -module-hash -module-summary %p/Inputs/module_hash.ll -o %t.m2.bc
+
+; Recover the hashes from the modules themselves.
+; RUN: llvm-bcanalyzer -dump %t.m1.bc | grep '<HASH' > %t.hash
+; RUN: llvm-bcanalyzer -dump %t.m2.bc | grep '<HASH' >> %t.hash
+
+; Generate the combined index and gather the hashes there.
+; RUN: llvm-lto --thinlto-action=thinlink -o - %t.m1.bc %t.m2.bc | llvm-bcanalyzer -dump | grep '<HASH ' >> %t.hash
+
+; Validate the output now, the hahes in the individual modules and the combined index are in the same file.
+; RUN: cat %t.hash | FileCheck %s --check-prefix=COMBINED
+
+; First capture the value of the hash for the two modules.
+; COMBINED: <HASH op0=[[HASH1_1:[0-9]*]] op1=[[HASH1_2:[0-9]*]] op2=[[HASH1_3:[0-9]*]] op3=[[HASH1_4:[0-9]*]] op4=[[HASH1_5:[0-9]*]] (match)/>
+; COMBINED: <HASH op0=[[HASH2_1:[0-9]*]] op1=[[HASH2_2:[0-9]*]] op2=[[HASH2_3:[0-9]*]] op3=[[HASH2_4:[0-9]*]] op4=[[HASH2_5:[0-9]*]] (match)/>
+
+; Validate against the value extracted from the combined index
+; COMBINED-DAG: <HASH abbrevid={{[0-9]*}} op0=[[HASH1_1]] op1=[[HASH1_2]] op2=[[HASH1_3]] op3=[[HASH1_4]] op4=[[HASH1_5]]/>
+; COMBINED-DAG: <HASH abbrevid={{[0-9]*}} op0=[[HASH2_1]] op1=[[HASH2_2]] op2=[[HASH2_3]] op3=[[HASH2_4]] op4=[[HASH2_5]]/>
+
+
+; Need a function for the combined index to be populated.
+define void @foo() {
+ ret void
+}
diff --git a/test/Bitcode/operand-bundles-bc-analyzer.ll b/test/Bitcode/operand-bundles-bc-analyzer.ll
new file mode 100644
index 0000000000000..8f7aa37cbed80
--- /dev/null
+++ b/test/Bitcode/operand-bundles-bc-analyzer.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump -disable-histogram | FileCheck %s
+
+; CHECK: <OPERAND_BUNDLE_TAGS_BLOCK
+; CHECK-NEXT: <OPERAND_BUNDLE_TAG
+; CHECK-NEXT: <OPERAND_BUNDLE_TAG
+; CHECK-NEXT: <OPERAND_BUNDLE_TAG
+; CHECK-NEXT: <OPERAND_BUNDLE_TAG
+; CHECK-NEXT: <OPERAND_BUNDLE_TAG
+; CHECK-NEXT: </OPERAND_BUNDLE_TAGS_BLOCK
+
+; CHECK: <FUNCTION_BLOCK
+; CHECK: <OPERAND_BUNDLE
+; CHECK: <OPERAND_BUNDLE
+; CHECK-NOT: <OPERAND_BUNDLE
+; CHECK: </FUNCTION_BLOCK
+
+; CHECK: Block ID #{{[0-9]+}} (OPERAND_BUNDLE_TAGS_BLOCK)
+
+declare void @callee0()
+
+define void @f0(i32* %ptr) {
+ entry:
+ %l = load i32, i32* %ptr
+ %x = add i32 42, 1
+ call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
+ ret void
+}
diff --git a/test/Bitcode/source-filename.test b/test/Bitcode/source-filename.test
new file mode 100644
index 0000000000000..d12cd3bb30d4c
--- /dev/null
+++ b/test/Bitcode/source-filename.test
@@ -0,0 +1,2 @@
+; RUN: llvm-bcanalyzer -dump %p/Inputs/source-filename.bc | FileCheck %s
+; CHECK: <SOURCE_FILENAME {{.*}} record string = 'source-filename.c'
diff --git a/test/Bitcode/summary_version.ll b/test/Bitcode/summary_version.ll
new file mode 100644
index 0000000000000..718a0ab9bd7f6
--- /dev/null
+++ b/test/Bitcode/summary_version.ll
@@ -0,0 +1,12 @@
+; Check summary versioning
+; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; CHECK: <VERSION op0=1/>
+
+
+
+; Need a function for the summary to be populated.
+define void @foo() {
+ ret void
+}
diff --git a/test/Bitcode/thinlto-alias.ll b/test/Bitcode/thinlto-alias.ll
new file mode 100644
index 0000000000000..58411ca652377
--- /dev/null
+++ b/test/Bitcode/thinlto-alias.ll
@@ -0,0 +1,47 @@
+; Test to check the callgraph in summary
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: opt -module-summary %p/Inputs/thinlto-alias.ll -o %t2.o
+; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
+; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; CHECK-NEXT: <VERSION
+; See if the call to func is registered, using the expected callsite count
+; and value id matching the subsequent value symbol table.
+; CHECK-NEXT: <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
+; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; CHECK-NEXT: <VALUE_SYMTAB
+; CHECK-NEXT: <FNENTRY {{.*}} record string = 'main'
+; External function analias should have entry with value id FUNCID
+; CHECK-NEXT: <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'analias'
+; CHECK-NEXT: </VALUE_SYMTAB>
+
+; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VERSION
+; See if the call to analias is registered, using the expected callsite count
+; and value id matching the subsequent value symbol table.
+; COMBINED-NEXT: <COMBINED {{.*}} op5=[[ALIASID:[0-9]+]] op6=1/>
+; Followed by the alias and aliasee
+; COMBINED-NEXT: <COMBINED {{.*}}
+; COMBINED-NEXT: <COMBINED_ALIAS {{.*}} op3=[[ALIASEEID:[0-9]+]]
+; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VALUE_SYMTAB
+; Entry for function func should have entry with value id ALIASID
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[ALIASID]] op1=-5751648690987223394/>
+; COMBINED-NEXT: <COMBINED
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[ALIASEEID]] op1=-1039159065113703048/>
+; COMBINED-NEXT: </VALUE_SYMTAB>
+
+; ModuleID = 'thinlto-function-summary-callgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define i32 @main() {
+entry:
+ call void (...) @analias()
+ ret i32 0
+}
+
+declare void @analias(...)
diff --git a/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll b/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
new file mode 100644
index 0000000000000..a927a16be1583
--- /dev/null
+++ b/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
@@ -0,0 +1,46 @@
+; Test to check the callgraph in summary when there is PGO
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
+; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
+; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; CHECK-NEXT: <VERSION
+; See if the call to func is registered, using the expected callsite count
+; and profile count, with value id matching the subsequent value symbol table.
+; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1 op6=1/>
+; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; CHECK-NEXT: <VALUE_SYMTAB
+; CHECK-NEXT: <FNENTRY {{.*}} record string = 'main'
+; External function func should have entry with value id FUNCID
+; CHECK-NEXT: <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
+; CHECK-NEXT: </VALUE_SYMTAB>
+
+; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VERSION
+; COMBINED-NEXT: <COMBINED
+; See if the call to func is registered, using the expected callsite count
+; and profile count, with value id matching the subsequent value symbol table.
+; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op5=[[FUNCID:[0-9]+]] op6=1 op7=1/>
+; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; COMBINED-NEXT: <VALUE_SYMTAB
+; Entry for function func should have entry with value id FUNCID
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
+; COMBINED-NEXT: <COMBINED
+; COMBINED-NEXT: </VALUE_SYMTAB>
+
+; ModuleID = 'thinlto-function-summary-callgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 !prof !2 {
+entry:
+ call void (...) @func()
+ ret i32 0
+}
+
+declare void @func(...) #1
+
+!2 = !{!"function_entry_count", i64 1}
diff --git a/test/Bitcode/thinlto-function-summary-callgraph.ll b/test/Bitcode/thinlto-function-summary-callgraph.ll
new file mode 100644
index 0000000000000..af38c3ef12178
--- /dev/null
+++ b/test/Bitcode/thinlto-function-summary-callgraph.ll
@@ -0,0 +1,44 @@
+; Test to check the callgraph in summary
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
+; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
+; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; CHECK-NEXT: <VERSION
+; See if the call to func is registered, using the expected callsite count
+; and value id matching the subsequent value symbol table.
+; CHECK-NEXT: <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
+; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; CHECK-NEXT: <VALUE_SYMTAB
+; CHECK-NEXT: <FNENTRY {{.*}} record string = 'main'
+; External function func should have entry with value id FUNCID
+; CHECK-NEXT: <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
+; CHECK-NEXT: </VALUE_SYMTAB>
+
+; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VERSION
+; COMBINED-NEXT: <COMBINED
+; See if the call to func is registered, using the expected callsite count
+; and value id matching the subsequent value symbol table.
+; COMBINED-NEXT: <COMBINED {{.*}} op5=[[FUNCID:[0-9]+]] op6=1/>
+; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; COMBINED-NEXT: <VALUE_SYMTAB
+; Entry for function func should have entry with value id FUNCID
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
+; COMBINED-NEXT: <COMBINED
+; COMBINED-NEXT: </VALUE_SYMTAB>
+
+; ModuleID = 'thinlto-function-summary-callgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+entry:
+ call void (...) @func()
+ ret i32 0
+}
+
+declare void @func(...) #1
diff --git a/test/Bitcode/thinlto-function-summary-originalnames.ll b/test/Bitcode/thinlto-function-summary-originalnames.ll
new file mode 100644
index 0000000000000..8777bd9160765
--- /dev/null
+++ b/test/Bitcode/thinlto-function-summary-originalnames.ll
@@ -0,0 +1,32 @@
+; Test to check the callgraph in summary
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t.o
+; RUN: llvm-bcanalyzer -dump %t.index.bc | FileCheck %s --check-prefix=COMBINED
+
+; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VERSION
+; COMBINED-DAG: <COMBINED
+; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=6699318081062747564/>
+; COMBINED-DAG: <COMBINED_GLOBALVAR_INIT_REFS
+; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=-2012135647395072713/>
+; COMBINED-DAG: <COMBINED_ALIAS
+; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=-4170563161550796836/>
+; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+; COMBINED-NEXT: <VALUE_SYMTAB
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=4947176790635855146/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=-6591587165810580810/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=-4377693495213223786/>
+; COMBINED-NEXT: </VALUE_SYMTAB>
+
+source_filename = "/path/to/source.c"
+
+; ModuleID = 'thinlto-function-summary-callgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@bar = internal global i32 0
+@fooalias = internal alias void (...), bitcast (void ()* @foo to void (...)*)
+
+define internal void @foo() {
+ ret void
+}
diff --git a/test/Bitcode/thinlto-function-summary-refgraph.ll b/test/Bitcode/thinlto-function-summary-refgraph.ll
new file mode 100644
index 0000000000000..73aeb08545e33
--- /dev/null
+++ b/test/Bitcode/thinlto-function-summary-refgraph.ll
@@ -0,0 +1,121 @@
+; Test to check both the callgraph and refgraph in summary
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+
+; See if the calls and other references are recorded properly using the
+; expected value id and other information as appropriate (callsite cout
+; for calls). Use different linkage types for the various test cases to
+; distinguish the test cases here (op1 contains the linkage type).
+; Note that op3 contains the # non-call references.
+; This also ensures that we didn't include a call or reference to intrinsic
+; llvm.ctpop.i8.
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; Function main contains call to func, as well as address reference to func:
+; CHECK-DAG: <PERMODULE {{.*}} op0=[[MAINID:[0-9]+]] op1=0 {{.*}} op3=1 op4=[[FUNCID:[0-9]+]] op5=[[FUNCID]] op6=1/>
+; Function W contains a call to func3 as well as a reference to globalvar:
+; CHECK-DAG: <PERMODULE {{.*}} op0=[[WID:[0-9]+]] op1=5 {{.*}} op3=1 op4=[[GLOBALVARID:[0-9]+]] op5=[[FUNC3ID:[0-9]+]] op6=1/>
+; Function X contains call to foo, as well as address reference to foo
+; which is in the same instruction as the call:
+; CHECK-DAG: <PERMODULE {{.*}} op0=[[XID:[0-9]+]] op1=1 {{.*}} op3=1 op4=[[FOOID:[0-9]+]] op5=[[FOOID]] op6=1/>
+; Function Y contains call to func2, and ensures we don't incorrectly add
+; a reference to it when reached while earlier analyzing the phi using its
+; return value:
+; CHECK-DAG: <PERMODULE {{.*}} op0=[[YID:[0-9]+]] op1=8 {{.*}} op3=0 op4=[[FUNC2ID:[0-9]+]] op5=1/>
+; Function Z contains call to func2, and ensures we don't incorrectly add
+; a reference to it when reached while analyzing subsequent use of its return
+; value:
+; CHECK-DAG: <PERMODULE {{.*}} op0=[[ZID:[0-9]+]] op1=3 {{.*}} op3=0 op4=[[FUNC2ID:[0-9]+]] op5=1/>
+; Variable bar initialization contains address reference to func:
+; CHECK-DAG: <PERMODULE_GLOBALVAR_INIT_REFS {{.*}} op0=[[BARID:[0-9]+]] op1=0 op2=[[FUNCID]]/>
+; CHECK: </GLOBALVAL_SUMMARY_BLOCK>
+
+; CHECK-NEXT: <VALUE_SYMTAB
+; CHECK-DAG: <ENTRY {{.*}} op0=[[BARID]] {{.*}} record string = 'bar'
+; CHECK-DAG: <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
+; CHECK-DAG: <ENTRY {{.*}} op0=[[FOOID]] {{.*}} record string = 'foo'
+; CHECK-DAG: <FNENTRY {{.*}} op0=[[MAINID]] {{.*}} record string = 'main'
+; CHECK-DAG: <FNENTRY {{.*}} op0=[[WID]] {{.*}} record string = 'W'
+; CHECK-DAG: <FNENTRY {{.*}} op0=[[XID]] {{.*}} record string = 'X'
+; CHECK-DAG: <FNENTRY {{.*}} op0=[[YID]] {{.*}} record string = 'Y'
+; CHECK-DAG: <FNENTRY {{.*}} op0=[[ZID]] {{.*}} record string = 'Z'
+; CHECK-DAG: <ENTRY {{.*}} op0=[[FUNC2ID]] {{.*}} record string = 'func2'
+; CHECK-DAG: <ENTRY {{.*}} op0=[[FUNC3ID]] {{.*}} record string = 'func3'
+; CHECK-DAG: <ENTRY {{.*}} op0=[[GLOBALVARID]] {{.*}} record string = 'globalvar'
+; CHECK: </VALUE_SYMTAB>
+
+; ModuleID = 'thinlto-function-summary-refgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@bar = global void (...)* bitcast (void ()* @func to void (...)*), align 8
+
+@globalvar = global i32 0, align 4
+
+declare void @func() #0
+declare i32 @func2(...) #1
+declare void @foo(i8* %F) #0
+declare i32 @func3(i32* dereferenceable(4)) #2
+
+; Function Attrs: nounwind uwtable
+define weak_odr void @W() #0 {
+entry:
+ %call = tail call i32 @func3(i32* nonnull dereferenceable(4) @globalvar)
+ ret void
+}
+
+; Function Attrs: nounwind uwtable
+define available_externally void @X() #0 {
+entry:
+ call void @foo(i8* bitcast (void (i8*)* @foo to i8*))
+ ret void
+}
+
+; Function Attrs: nounwind uwtable
+define private i32 @Y(i32 %i) #0 {
+entry:
+ %cmp3 = icmp slt i32 %i, 10
+ br i1 %cmp3, label %while.body.preheader, label %while.end
+
+while.body.preheader: ; preds = %entry
+ br label %while.body
+
+while.body: ; preds = %while.body.preheader, %while.body
+ %j.05 = phi i32 [ %add, %while.body ], [ 0, %while.body.preheader ]
+ %i.addr.04 = phi i32 [ %inc, %while.body ], [ %i, %while.body.preheader ]
+ %inc = add nsw i32 %i.addr.04, 1
+ %call = tail call i32 (...) @func2() #2
+ %add = add nsw i32 %call, %j.05
+ %exitcond = icmp eq i32 %inc, 10
+ br i1 %exitcond, label %while.end.loopexit, label %while.body
+
+while.end.loopexit: ; preds = %while.body
+ %add.lcssa = phi i32 [ %add, %while.body ]
+ br label %while.end
+
+while.end: ; preds = %while.end.loopexit, %entry
+ %j.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa, %while.end.loopexit ]
+ ret i32 %j.0.lcssa
+}
+
+; Function Attrs: nounwind uwtable
+define linkonce_odr i32 @Z() #0 {
+entry:
+ %call = tail call i32 (...) @func2() #2
+ ret i32 %call
+}
+
+declare i8 @llvm.ctpop.i8(i8)
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+entry:
+ %retval = alloca i32, align 4
+ %foo = alloca void (...)*, align 8
+ store i32 0, i32* %retval, align 4
+ store void (...)* bitcast (void ()* @func to void (...)*), void (...)** %foo, align 8
+ %0 = load void (...)*, void (...)** %foo, align 8
+ call void (...) %0()
+ call void @func()
+ call i8 @llvm.ctpop.i8( i8 10 )
+ ret i32 0
+}
diff --git a/test/Bitcode/thinlto-function-summary.ll b/test/Bitcode/thinlto-function-summary.ll
index 9c2f2acd6c7a8..f3fb6c4f01055 100644
--- a/test/Bitcode/thinlto-function-summary.ll
+++ b/test/Bitcode/thinlto-function-summary.ll
@@ -1,13 +1,23 @@
-; RUN: llvm-as -function-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
-; Check for function summary block/records.
-
-; BC: <FUNCTION_SUMMARY_BLOCK
-; BC-NEXT: <PERMODULE_ENTRY
-; BC-NEXT: <PERMODULE_ENTRY
-; BC-NEXT: <PERMODULE_ENTRY
-; BC-NEXT: </FUNCTION_SUMMARY_BLOCK
-
-; RUN: llvm-as -function-summary < %s | llvm-dis | FileCheck %s
+; RUN: opt -name-anon-functions -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
+; Check for summary block/records.
+
+; Check the value ids in the summary entries against the
+; same in the ValueSumbolTable, to ensure the ordering is stable.
+; Also check the linkage field on the summary entries.
+; BC: <GLOBALVAL_SUMMARY_BLOCK
+; BC-NEXT: <VERSION
+; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
+; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
+; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
+; BC-NEXT: <ALIAS {{.*}} op0=4 op1=0 op2=3
+; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
+; BC-NEXT: <VALUE_SYMTAB
+; BC-NEXT: <FNENTRY {{.*}} op0=3 {{.*}}> record string = 'anon.
+; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
+; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
+; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'f'
+
+; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s
; Check that this round-trips correctly.
; ModuleID = '<stdin>'
@@ -30,6 +40,9 @@ entry:
ret i32 %x
}
+; FIXME: Anonymous function and alias not currently in summary until
+; follow on fixes to rename anonymous functions and emit alias summary
+; entries are committed.
; Check an anonymous function as well, since in that case only the alias
; ends up in the value symbol table and having a summary.
@f = alias void (), void ()* @0 ; <void ()*> [#uses=0]
diff --git a/test/Bitcode/thinlto-summary-globalvar.ll b/test/Bitcode/thinlto-summary-globalvar.ll
new file mode 100644
index 0000000000000..56f9c0788751b
--- /dev/null
+++ b/test/Bitcode/thinlto-summary-globalvar.ll
@@ -0,0 +1,5 @@
+; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+
+@a = global i32 0
diff --git a/test/Bitcode/thinlto-summary-linkage-types.ll b/test/Bitcode/thinlto-summary-linkage-types.ll
new file mode 100644
index 0000000000000..e8fea12e40ba2
--- /dev/null
+++ b/test/Bitcode/thinlto-summary-linkage-types.ll
@@ -0,0 +1,61 @@
+; Check the linkage types in both the per-module and combined summaries.
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: llvm-lto -thinlto -o %t2 %t.o
+; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+define private void @private()
+; CHECK: <PERMODULE {{.*}} op1=8
+; COMBINED-DAG: <COMBINED {{.*}} op2=8
+{
+ ret void
+}
+
+define internal void @internal()
+; CHECK: <PERMODULE {{.*}} op1=7
+; COMBINED-DAG: <COMBINED {{.*}} op2=7
+{
+ ret void
+}
+
+define available_externally void @available_externally()
+; CHECK: <PERMODULE {{.*}} op1=1
+; COMBINED-DAG: <COMBINED {{.*}} op2=1
+{
+ ret void
+}
+
+define linkonce void @linkonce()
+; CHECK: <PERMODULE {{.*}} op1=2
+; COMBINED-DAG: <COMBINED {{.*}} op2=2
+{
+ ret void
+}
+
+define weak void @weak()
+; CHECK: <PERMODULE {{.*}} op1=4
+; COMBINED-DAG: <COMBINED {{.*}} op2=4
+{
+ ret void
+}
+
+define linkonce_odr void @linkonce_odr()
+; CHECK: <PERMODULE {{.*}} op1=3
+; COMBINED-DAG: <COMBINED {{.*}} op2=3
+{
+ ret void
+}
+
+define weak_odr void @weak_odr()
+; CHECK: <PERMODULE {{.*}} op1=5
+; COMBINED-DAG: <COMBINED {{.*}} op2=5
+{
+ ret void
+}
+
+define external void @external()
+; CHECK: <PERMODULE {{.*}} op1=0
+; COMBINED-DAG: <COMBINED {{.*}} op2=0
+{
+ ret void
+}
diff --git a/test/Bitcode/thinlto-summary-section.ll b/test/Bitcode/thinlto-summary-section.ll
new file mode 100644
index 0000000000000..d120622db8197
--- /dev/null
+++ b/test/Bitcode/thinlto-summary-section.ll
@@ -0,0 +1,11 @@
+; Check the linkage types in both the per-module and combined summaries.
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: llvm-lto -thinlto -o %t2 %t.o
+; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+; CHECK: <PERMODULE {{.*}} op1=16
+; COMBINED-DAG: <COMBINED {{.*}} op2=16
+define void @functionWithSection() section "some_section" {
+ ret void
+}
diff --git a/test/Bitcode/upgrade-module-flag.ll b/test/Bitcode/upgrade-module-flag.ll
new file mode 100644
index 0000000000000..fe52a3298e4b0
--- /dev/null
+++ b/test/Bitcode/upgrade-module-flag.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+; RUN: verify-uselistorder < %s
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"Objective-C Image Info Version", i32 0}
+
+; CHECK: !0 = !{i32 1, !"Objective-C Image Info Version", i32 0}
+; CHECK: !1 = !{i32 1, !"Objective-C Class Properties", i32 0}
diff --git a/test/Bitcode/upgrade-subprogram-this.ll b/test/Bitcode/upgrade-subprogram-this.ll
new file mode 100644
index 0000000000000..d84aa0aad44ed
--- /dev/null
+++ b/test/Bitcode/upgrade-subprogram-this.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-dis < %s.bc | FileCheck %s
+; RUN: verify-uselistorder < %s.bc
+
+; Test upgrading from bitcode without a this adjustment record. It will fill in
+; an implicit zero thisAdjustment, so it will not be present in the output.
+
+; CHECK: DISubprogram(name: "f",
+; CHECK-NOT: thisAdjustment
+; CHECK-SAME: ){{$}}
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.23918"
+
+; Function Attrs: nounwind uwtable
+define void @f() !dbg !7 {
+entry:
+ ret void, !dbg !10
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, emissionKind: FullDebug)
+!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
+!2 = !{}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!7 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+!8 = !DISubroutineType(types: !9)
+!9 = !{null}
+!10 = !DILocation(line: 1, column: 11, scope: !7)
diff --git a/test/Bitcode/upgrade-subprogram-this.ll.bc b/test/Bitcode/upgrade-subprogram-this.ll.bc
new file mode 100644
index 0000000000000..bc838a1cd833e
--- /dev/null
+++ b/test/Bitcode/upgrade-subprogram-this.ll.bc
Binary files differ
diff --git a/test/Bitcode/upgrade-subprogram.ll b/test/Bitcode/upgrade-subprogram.ll
index 8d5c000a1480e..fb807ed6daaf0 100644
--- a/test/Bitcode/upgrade-subprogram.ll
+++ b/test/Bitcode/upgrade-subprogram.ll
@@ -10,7 +10,7 @@ define void @foo() {
!0 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.dbg.cu = !{!1}
-!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 1)
+!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, emissionKind: FullDebug)
!2 = !DIFile(filename: "foo.c", directory: "/path/to/dir")
; CHECK: [[SP]] = distinct !DISubprogram
!3 = distinct !DISubprogram(file: !2, scope: !2, line: 51, name: "foo", function: void ()* @foo, type: !4)