aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/dsymutil/ARM/obfuscated.test34
-rw-r--r--llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.obin0 -> 2104 bytes
-rwxr-xr-xllvm/test/tools/dsymutil/Inputs/private/tmp/label/label.outbin0 -> 16720 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.obin0 -> 2944 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.obin0 -> 3616 bytes
-rwxr-xr-xllvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylibbin0 -> 50112 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.obin0 -> 2504 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.obin0 -> 2528 bytes
-rw-r--r--llvm/test/tools/dsymutil/X86/basic-linking-bundle.test2
-rw-r--r--llvm/test/tools/dsymutil/X86/basic-linking-x86.test66
-rw-r--r--llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test214
-rw-r--r--llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test21
-rw-r--r--llvm/test/tools/dsymutil/X86/dsym-companion.test4
-rw-r--r--llvm/test/tools/dsymutil/X86/frame-2.test10
-rw-r--r--llvm/test/tools/dsymutil/X86/label2.test21
-rw-r--r--llvm/test/tools/dsymutil/X86/minimize.test9
-rw-r--r--llvm/test/tools/dsymutil/X86/thinlto.test24
-rw-r--r--llvm/test/tools/dsymutil/X86/update.test12
-rw-r--r--llvm/test/tools/dsymutil/cmdline.test1
-rw-r--r--llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s7
-rw-r--r--llvm/test/tools/llvm-exegesis/X86/uops-misspelled-div.s8
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A53-carry-over.s83
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A55-add-sequence.s24
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-stats.s33
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-views.s61
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A55-in-order-retire.s59
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/A55-out-of-order-retire.s54
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-0-single-add.s14
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-1-add-seq.s15
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-10-fma.s15
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-11-fma-mix.s19
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-2-skewed-alu.s18
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-3-mul.s16
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-4-sdiv.s21
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-5-mul-sdiv.s22
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-6-mul.s25
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-7-cmp.s17
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-8-ldr.s19
-rw-r--r--llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-9-fabs.s15
-rw-r--r--llvm/test/tools/llvm-mca/AMDGPU/gfx10-add-sequence.s14
-rw-r--r--llvm/test/tools/llvm-mca/AMDGPU/gfx10-double.s187
-rw-r--r--llvm/test/tools/llvm-mca/ARM/m7-negative-readadvance.s14
-rw-r--r--llvm/test/tools/llvm-mca/X86/BtVer2/negative-read-advance.s90
-rw-r--r--llvm/test/tools/llvm-ml/hexfloat_error.asm10
-rw-r--r--llvm/test/tools/llvm-ml/hexfloat_warn.asm12
-rw-r--r--llvm/test/tools/llvm-ml/variable.asm14
-rw-r--r--llvm/test/tools/llvm-nm/ARM/special-syms.test30
-rw-r--r--llvm/test/tools/llvm-nm/debug-syms.test4
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s5
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s16
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s12
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s2
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s4
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s4
-rw-r--r--llvm/test/tools/llvm-objdump/ELF/AMDGPU/subtarget.ll10
-rw-r--r--llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test58
-rw-r--r--llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test2
-rw-r--r--llvm/test/tools/llvm-pdbutil/stripped.test2
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext6
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext6
-rw-r--r--llvm/test/tools/llvm-profdata/merge-incompatible.test2
-rw-r--r--llvm/test/tools/llvm-profgen/cs-preinline.test41
-rw-r--r--llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test10
-rw-r--r--llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test63
-rw-r--r--llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-headers.test393
-rw-r--r--llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test5
-rw-r--r--llvm/test/tools/llvm-readobj/ELF/note-amd.s49
-rw-r--r--llvm/test/tools/llvm-readobj/wasm/wasm-imports.test4
-rwxr-xr-xllvm/test/tools/llvm-reduce/Inputs/remove-args.py16
-rwxr-xr-xllvm/test/tools/llvm-reduce/Inputs/remove-bbs.py15
-rwxr-xr-xllvm/test/tools/llvm-reduce/Inputs/remove-instructions.py17
-rwxr-xr-xllvm/test/tools/llvm-reduce/Inputs/remove-metadata.py8
-rw-r--r--llvm/test/tools/llvm-reduce/do-not-remove-terminator.ll19
-rw-r--r--llvm/test/tools/llvm-reduce/no-replace-intrinsic-callee-with-undef.ll28
-rw-r--r--llvm/test/tools/llvm-reduce/remove-alias.ll52
-rw-r--r--llvm/test/tools/llvm-reduce/remove-all-of-multiple-args.ll12
-rw-r--r--llvm/test/tools/llvm-reduce/remove-args-2.ll23
-rw-r--r--llvm/test/tools/llvm-reduce/remove-args-from-declaration.ll24
-rw-r--r--llvm/test/tools/llvm-reduce/remove-args-used-by-ret.ll14
-rw-r--r--llvm/test/tools/llvm-reduce/remove-args.ll12
-rw-r--r--llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsic-like-functions.ll40
-rw-r--r--llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsics.ll38
-rw-r--r--llvm/test/tools/llvm-reduce/remove-bbs-ret-nonvoid.ll29
-rw-r--r--llvm/test/tools/llvm-reduce/remove-bbs-unwinded-to.ll39
-rw-r--r--llvm/test/tools/llvm-reduce/remove-bbs.ll29
-rw-r--r--llvm/test/tools/llvm-reduce/remove-call-site-attributes.ll38
-rw-r--r--llvm/test/tools/llvm-reduce/remove-dso-local.ll24
-rw-r--r--llvm/test/tools/llvm-reduce/remove-funcs.ll31
-rw-r--r--llvm/test/tools/llvm-reduce/remove-function-arguments-of-funcs-used-in-blockaddress.ll30
-rw-r--r--llvm/test/tools/llvm-reduce/remove-function-attributes.ll23
-rw-r--r--llvm/test/tools/llvm-reduce/remove-function-bodies-comdat.ll22
-rw-r--r--llvm/test/tools/llvm-reduce/remove-function-bodies-used-in-globals.ll17
-rw-r--r--llvm/test/tools/llvm-reduce/remove-function-bodies.ll17
-rw-r--r--llvm/test/tools/llvm-reduce/remove-global-variable-attributes.ll27
-rw-r--r--llvm/test/tools/llvm-reduce/remove-global-vars.ll56
-rw-r--r--llvm/test/tools/llvm-reduce/remove-instructions.ll26
-rw-r--r--llvm/test/tools/llvm-reduce/remove-invoked-functions.ll55
-rw-r--r--llvm/test/tools/llvm-reduce/remove-metadata.ll19
-rw-r--r--llvm/test/tools/llvm-reduce/remove-module-inline-asm.ll11
-rw-r--r--llvm/test/tools/llvm-reduce/remove-multiple-use-of-args-in-same-instruction.ll17
-rw-r--r--llvm/test/tools/llvm-reduce/remove-multiple-use-of-global-vars-in-same-instruction.ll23
-rw-r--r--llvm/test/tools/llvm-reduce/remove-operand-bundles.ll40
-rw-r--r--llvm/test/tools/llvm-reduce/remove-single-arg.ll12
-rw-r--r--llvm/test/tools/llvm-reduce/remove-unused-declarations.ll21
104 files changed, 2505 insertions, 451 deletions
diff --git a/llvm/test/tools/dsymutil/ARM/obfuscated.test b/llvm/test/tools/dsymutil/ARM/obfuscated.test
index b0e3918b7ae6..a09adf73f13a 100644
--- a/llvm/test/tools/dsymutil/ARM/obfuscated.test
+++ b/llvm/test/tools/dsymutil/ARM/obfuscated.test
@@ -4,6 +4,10 @@ RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.a
RUN: | llvm-dwarfdump -v - \
RUN: | FileCheck %s
+RUN: dsymutil --accelerator=Pub --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
+RUN: | llvm-dwarfdump -v - \
+RUN: | FileCheck --check-prefix=PUB %s
+
RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
RUN: | llvm-dwarfdump -v - \
RUN: | FileCheck --check-prefix=NOHIDDEN %s
@@ -118,21 +122,21 @@ CHECK: dir_index: 0
CHECK: mod_time: 0x00000000
CHECK: length: 0x00000000
-CHECK: .debug_pubnames contents:
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000044
-CHECK: 0x0000002e "main"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000044, unit_size = 0x00000044
-CHECK: 0x0000002e "one"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000088, unit_size = 0x00000044
-CHECK: 0x0000002e "two"
-CHECK: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x000000cc, unit_size = 0x00000044
-CHECK: 0x0000002e "three"
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000110, unit_size = 0x00000044
-CHECK: 0x0000002e "four"
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x00000044
-CHECK: 0x0000002e "five"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000198, unit_size = 0x00000044
-CHECK: 0x0000002e "six"
+PUB: .debug_pubnames contents:
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000044
+PUB: 0x0000002e "main"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000044, unit_size = 0x00000044
+PUB: 0x0000002e "one"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000088, unit_size = 0x00000044
+PUB: 0x0000002e "two"
+PUB: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x000000cc, unit_size = 0x00000044
+PUB: 0x0000002e "three"
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000110, unit_size = 0x00000044
+PUB: 0x0000002e "four"
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x00000044
+PUB: 0x0000002e "five"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000198, unit_size = 0x00000044
+PUB: 0x0000002e "six"
CHECK: .apple_names contents:
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.o
new file mode 100644
index 000000000000..e999a42f7933
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.out b/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.out
new file mode 100755
index 000000000000..21e92d56a260
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.out
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
new file mode 100644
index 000000000000..26d795f44e1a
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
new file mode 100644
index 000000000000..b7dcab5c27ba
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
new file mode 100755
index 000000000000..75b22f377237
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
new file mode 100644
index 000000000000..119b9268e539
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
new file mode 100644
index 000000000000..1c207a7e8515
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test b/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
index 650ed1a8484c..0e8cc2e61dad 100644
--- a/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
+++ b/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
@@ -2,7 +2,7 @@ RUN: rm -rf %t
RUN: mkdir -p %t/dsymdest
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t/basic.macho.x86_64
-RUN: dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -oso-prepend-path=%p/.. %t/basic.macho.x86_64
Check that the object file in the bundle exists and is sane:
RUN: llvm-dwarfdump -a %t/basic.macho.x86_64.dSYM/Contents/Resources/DWARF/basic.macho.x86_64 | FileCheck %S/basic-linking-x86.test
diff --git a/llvm/test/tools/dsymutil/X86/basic-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
index 754aaf3d4e89..13ea0858437f 100644
--- a/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
@@ -1,12 +1,12 @@
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1
-RUN: dsymutil -f -oso-prepend-path=%p/.. %t1
+RUN: dsymutil -accelerator=Pub -f -oso-prepend-path=%p/.. %t1
RUN: llvm-dwarfdump -a %t1.dwarf | FileCheck %s
-RUN: dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
RUN: llvm-dwarfdump -a %t2 | FileCheck %s
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE
-RUN: dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | dsymutil -f -y -o - - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC
-RUN: dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | dsymutil -f -o - -y - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE
+RUN: dsymutil -accelerator=Pub -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC,PUB
+RUN: dsymutil -accelerator=Pub -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE,PUB
+RUN: dsymutil -accelerator=Pub -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | dsymutil -accelerator=Pub -f -y -o - - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC,PUB
+RUN: dsymutil -accelerator=Pub -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | dsymutil -accelerator=Pub -f -o - -y - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE,PUB
CHECK: file format Mach-O 64-bit x86-64
@@ -189,30 +189,30 @@ CHECK-NEXT: 0x0000000100000f90 11 0 1 0 0 is_stmt
CHECK-NEXT: 0x0000000100000f9b 12 0 1 0 0 is_stmt prologue_end
CHECK-NEXT: 0x0000000100000fa9 12 0 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "main"
-CHECK-NEXT: length = 0x00000036, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002d "private_int"
-CHECK-NEXT: 0x00000042 "baz"
-CHECK-NEXT: 0x00000057 "foo"
-CHECK-NEXT: 0x00000086 "inc"
-CHECK-NEXT: length = 0x00000026, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "val"
-CHECK-NEXT: 0x00000048 "bar"
-CHECK-NEXT: 0x00000077 "inc"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000063 "int"
-CHECK-NEXT: 0x00000079 "char"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "int"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000041 "int"
+PUB: .debug_pubnames contents:
+PUB-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "main"
+PUB-NEXT: length = 0x00000036, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x0000002d "private_int"
+PUB-NEXT: 0x00000042 "baz"
+PUB-NEXT: 0x00000057 "foo"
+PUB-NEXT: 0x00000086 "inc"
+PUB-NEXT: length = 0x00000026, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "val"
+PUB-NEXT: 0x00000048 "bar"
+PUB-NEXT: 0x00000077 "inc"
+
+PUB: .debug_pubtypes contents:
+PUB-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000063 "int"
+PUB-NEXT: 0x00000079 "char"
+PUB-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "int"
+PUB-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000041 "int"
diff --git a/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
index e1dc3f411cb4..867d822a9d9b 100644
--- a/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
@@ -179,24 +179,196 @@ CHECK-NEXT: 0x0000000100000fab 19 10 1 0 0
CHECK-NEXT: 0x0000000100000fb2 20 1 1 0 0 is_stmt
CHECK-NEXT: 0x0000000100000fb4 20 1 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000077
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "main"
-CHECK-NEXT: length = 0x0000002e, format = DWARF32, version = 0x0002, unit_offset = 0x00000077, unit_size = 0x000000a4
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000031 "baz"
-CHECK-NEXT: 0x00000046 "private_int"
-CHECK-NEXT: 0x00000067 "foo"
-CHECK-NEXT: length = 0x0000001e, format = DWARF32, version = 0x0002, unit_offset = 0x0000011b, unit_size = 0x00000085
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "val"
-CHECK-NEXT: 0x00000050 "bar"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000077
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000006f "char"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000077, unit_size = 0x000000a4
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "int"
+CHECK-NOT: .debug_pubnames contents:
+CHECK-NOT: .debug_pubtypes contents:
+
+CHECK: .apple_names contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 7
+CHECK-NEXT: Hashes count: 7
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: Hash 0xb8860c2 [
+CHECK-NEXT: Name@0x74 {
+CHECK-NEXT: String: 0x00000048 "baz"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000a8
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Hash 0xb88801f [
+CHECK-NEXT: Name@0x84 {
+CHECK-NEXT: String: 0x00000058 "inc"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x00000106
+CHECK-NEXT: ]
+CHECK-NEXT: Data 1 [
+CHECK-NEXT: Atom[0]: 0x00000193
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 1 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 2 [
+CHECK-NEXT: Hash 0xfed12c6a [
+CHECK-NEXT: Name@0x98 {
+CHECK-NEXT: String: 0x0000004c "private_int"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000bd
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 3 [
+CHECK-NEXT: Hash 0xb88b5c8 [
+CHECK-NEXT: Name@0xa8 {
+CHECK-NEXT: String: 0x0000006d "val"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x00000145
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Hash 0x7c9a7f6a [
+CHECK-NEXT: Name@0xb8 {
+CHECK-NEXT: String: 0x00000027 "main"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000002a
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 4 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 5 [
+CHECK-NEXT: Hash 0xb887389 [
+CHECK-NEXT: Name@0xc8 {
+CHECK-NEXT: String: 0x0000005c "foo"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000de
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 6 [
+CHECK-NEXT: Hash 0xb8860ba [
+CHECK-NEXT: Name@0xd8 {
+CHECK-NEXT: String: 0x00000071 "bar"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000016b
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+
+CHECK: .apple_types contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 2
+CHECK-NEXT: Hashes count: 2
+CHECK-NEXT: HeaderData length: 24
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 4
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: Atom 1 {
+CHECK-NEXT: Type: DW_ATOM_die_tag
+CHECK-NEXT: Form: DW_FORM_data2
+CHECK-NEXT: }
+CHECK-NEXT: Atom 2 {
+CHECK-NEXT: Type: DW_ATOM_type_flags
+CHECK-NEXT: Form: DW_FORM_data1
+CHECK-NEXT: }
+CHECK-NEXT: Atom 3 {
+CHECK-NEXT: Type: DW_ATOM_qual_name_hash
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: Hash 0xb888030 [
+CHECK-NEXT: Name@0x44 {
+CHECK-NEXT: String: 0x00000044 "int"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000a1
+CHECK-NEXT: Atom[1]: 0x0024 (DW_TAG_base_type)
+CHECK-NEXT: Atom[2]: 0x00
+CHECK-NEXT: Atom[3]: 0x0c3a28a4
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 1 [
+CHECK-NEXT: Hash 0x7c952063 [
+CHECK-NEXT: Name@0x5b {
+CHECK-NEXT: String: 0x00000036 "char"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000006f
+CHECK-NEXT: Atom[1]: 0x0024 (DW_TAG_base_type)
+CHECK-NEXT: Atom[2]: 0x00
+CHECK-NEXT: Atom[3]: 0x937bd757
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+
+CHECK: .apple_namespaces contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 1
+CHECK-NEXT: Hashes count: 0
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+
+CHECK: .apple_objc contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 1
+CHECK-NEXT: Hashes count: 0
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
diff --git a/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
index 509755a52155..4e5d142315f1 100644
--- a/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
@@ -178,25 +178,8 @@ CHECK: 0x0000000100000fa9 19 0 1 0 0 is_stmt
CHECK: 0x0000000100000fb2 20 0 1 0 0 is_stmt
CHECK: 0x0000000100000fb4 20 0 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "main"
-CHECK-NEXT: length = 0x0000002e, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000b9
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "private_int"
-CHECK-NEXT: 0x0000003f "baz"
-CHECK-NEXT: 0x00000058 "foo"
-CHECK-NEXT: length = 0x0000001e, format = DWARF32, version = 0x0002, unit_offset = 0x0000013a, unit_size = 0x000000ac
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "val"
-CHECK-NEXT: 0x00000045 "bar"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000063 "int"
-CHECK-NEXT: 0x00000079 "char"
+CHECK-NOT: .debug_pubnames contents:
+CHECK-NOT: .debug_pubtypes contents:
CHECK: .apple_names contents:
CHECK-NEXT: Header {
diff --git a/llvm/test/tools/dsymutil/X86/dsym-companion.test b/llvm/test/tools/dsymutil/X86/dsym-companion.test
index c9b0a1aa4f8d..d81ad7dc9244 100644
--- a/llvm/test/tools/dsymutil/X86/dsym-companion.test
+++ b/llvm/test/tools/dsymutil/X86/dsym-companion.test
@@ -1,5 +1,5 @@
-RUN: dsymutil -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK32
-RUN: dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK64
+RUN: dsymutil -accelerator=Pub -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK32
+RUN: dsymutil -accelerator=Pub -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK64
This test checks that the dSYM companion binaries generated in 32 and 64 bits
are correct. The check are pretty strict (we check even the offsets and sizes
diff --git a/llvm/test/tools/dsymutil/X86/frame-2.test b/llvm/test/tools/dsymutil/X86/frame-2.test
index 235d2ca18ca1..4ae94e25f7ca 100644
--- a/llvm/test/tools/dsymutil/X86/frame-2.test
+++ b/llvm/test/tools/dsymutil/X86/frame-2.test
@@ -7,9 +7,6 @@
# Check the handling of multiple different CIEs. To have CIEs that
# appear to be different, use a dwarf2 version of the file along with
# a dwarf 4 version. The CIE header version (and layout) will be different.
-# FIXME: this test also checks that we didn't reuse the first CIE when it
-# appears again. This is a behavior we inherited from dsymutil-classic
-# but this should be fixed (see comment in patchFrameInfoForObject())
---
triple: 'i386-apple-darwin'
objects:
@@ -39,11 +36,6 @@ objects:
# CHECK-NEXT: Version:{{.*}}4
# CHECK-NOT: FDE
# CHECK: FDE cie=[[CIEDW4]] pc=00003000...00003
-# CHECK-NOT: FDE
-# CHECK: [[CIEDW2:[0-9a-f]*]] {{[0-9a-f]*}} ffffffff CIE
-# CHECK-NEXT: Format: DWARF32
-# CHECK-NEXT: Version:{{.*}}1
-# CHECK-NOT: FDE
-# CHECK: FDE cie=[[CIEDW2]] pc=00004000...00004
+# CHECK: FDE cie=00000000 pc=00004000...00004
# CHECK-NOT: FDE
# CHECK: .eh_frame contents:
diff --git a/llvm/test/tools/dsymutil/X86/label2.test b/llvm/test/tools/dsymutil/X86/label2.test
new file mode 100644
index 000000000000..0517d1e7135b
--- /dev/null
+++ b/llvm/test/tools/dsymutil/X86/label2.test
@@ -0,0 +1,21 @@
+$ cat label.c
+int main(int argc, char **argv) {
+ if (argc) {
+ goto foobar;
+ }
+ return 1;
+foobar:
+ return 0;
+}
+
+$ clang -g label.c -c -o label.o
+$ clang label.o -o label.out
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/label/label.out -o %t.dSYM
+RUN: llvm-dwarfdump %t.dSYM | FileCheck %s
+
+CHECK: DW_TAG_label
+CHECK-NEXT: DW_AT_name ("foobar")
+CHECK-NEXT: DW_AT_decl_file ("/tmp/label{{[/\\]}}label.c")
+CHECK-NEXT: DW_AT_decl_line (6)
+CHECK-NEXT: DW_AT_low_pc (0x0000000100003f9d)
diff --git a/llvm/test/tools/dsymutil/X86/minimize.test b/llvm/test/tools/dsymutil/X86/minimize.test
deleted file mode 100644
index 4e2d5b568396..000000000000
--- a/llvm/test/tools/dsymutil/X86/minimize.test
+++ /dev/null
@@ -1,9 +0,0 @@
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s --check-prefix=FULL
-RUN: dsymutil --minimize -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s
-RUN: dsymutil -z -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s
-
-FULL: Name: __debug_pubnames
-FULL: Name: __debug_pubtypes
-
-CHECK-NOT: Name: __debug_pubnames
-CHECK-NOT: Name: __debug_pubtypes
diff --git a/llvm/test/tools/dsymutil/X86/thinlto.test b/llvm/test/tools/dsymutil/X86/thinlto.test
new file mode 100644
index 000000000000..ebd4068a5c12
--- /dev/null
+++ b/llvm/test/tools/dsymutil/X86/thinlto.test
@@ -0,0 +1,24 @@
+$ cat foo.cpp
+struct nontrivial {
+ nontrivial() { }
+};
+
+void function2()
+{
+ static const nontrivial magic_static;
+}
+
+$ cat bar.cpp
+void function2();
+
+void function1()
+{
+ function2();
+}
+
+$ xcrun clang++ -g -flto=thin -O2 foo.cpp bar.cpp -c
+$ xcrun clang++ -flto=thin foo.o bar.o -Xlinker -object_path_lto -Xlinker lto -shared -o foobar.dylib
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/foobar.dylib -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
+CHECK-NOT: could not find object file symbol for symbol __ZZ9function2vE12magic_static
+CHECK-NOT: could not find object file symbol for symbol __ZGVZ9function2vE12magic_static
diff --git a/llvm/test/tools/dsymutil/X86/update.test b/llvm/test/tools/dsymutil/X86/update.test
index 804091ab2943..d6c900911f52 100644
--- a/llvm/test/tools/dsymutil/X86/update.test
+++ b/llvm/test/tools/dsymutil/X86/update.test
@@ -1,15 +1,15 @@
RUN: rm -rf %t.dir
RUN: mkdir -p %t.dir
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t.dir/basic
-RUN: dsymutil -oso-prepend-path=%p/.. %t.dir/basic
+RUN: dsymutil -accelerator=Pub -oso-prepend-path=%p/.. %t.dir/basic
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil --update %t.dir/basic.dSYM
+RUN: dsymutil -accelerator=Pub --update %t.dir/basic.dSYM
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil -u %t.dir/basic.dSYM
+RUN: dsymutil -accelerator=Pub -u %t.dir/basic.dSYM
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil --update %t.dir/basic.dSYM -o %t.dir/updated.dSYM
+RUN: dsymutil -accelerator=Pub --update %t.dir/basic.dSYM -o %t.dir/updated.dSYM
RUN: llvm-dwarfdump -a %t.dir/updated.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
-RUN: dsymutil -f -u %t2 -o %t3
+RUN: dsymutil -accelerator=Pub -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -f -u %t2 -o %t3
RUN: llvm-dwarfdump -a %t3 | FileCheck %S/basic-linking-x86.test
diff --git a/llvm/test/tools/dsymutil/cmdline.test b/llvm/test/tools/dsymutil/cmdline.test
index e3f8bbdf7503..ec8c52ed596f 100644
--- a/llvm/test/tools/dsymutil/cmdline.test
+++ b/llvm/test/tools/dsymutil/cmdline.test
@@ -11,7 +11,6 @@ CHECK: -dump-debug-map
CHECK: -flat
CHECK: -gen-reproducer
CHECK: -help
-CHECK: -minimize
CHECK: -no-odr
CHECK: -no-output
CHECK: -no-swiftmodule-timestamp
diff --git a/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s b/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s
new file mode 100644
index 000000000000..67d652444e0c
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s
@@ -0,0 +1,7 @@
+# RUN: llvm-exegesis -mode=uops -opcode-name=POPCNT32rr 2>&1 | FileCheck %s
+
+CHECK: ---
+CHECK-NEXT: mode: uops
+CHECK-NEXT: key:
+CHECK-NEXT: instructions:
+CHECK-NEXT: - 'POPCNT32rr
diff --git a/llvm/test/tools/llvm-exegesis/X86/uops-misspelled-div.s b/llvm/test/tools/llvm-exegesis/X86/uops-misspelled-div.s
new file mode 100644
index 000000000000..05e8f4de9116
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/X86/uops-misspelled-div.s
@@ -0,0 +1,8 @@
+# RUN: not llvm-exegesis -mode=uops -snippets-file=%s 2>&1 | FileCheck %s
+
+# LLVM-EXEGESIS-DEFREG CL 1
+# LLVM-EXEGESIS-DEFREG AX 1
+div8r cl
+
+CHECK: error: invalid instruction mnemonic 'div8r'
+CHECK: llvm-exegesis error: cannot parse asm file
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A53-carry-over.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A53-carry-over.s
new file mode 100644
index 000000000000..a5715b965210
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A53-carry-over.s
@@ -0,0 +1,83 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a53 --timeline --iterations=1 < %s | FileCheck %s
+
+ldp w3, w5, [x10], #4 // 2uop + 1uop carry over
+add w10, w11, w12
+add w13, w14, w15
+ldp w7, w8, [x11] // 2uop, no carry over
+add w16, w17, w18
+add w19, w20, w21
+
+# CHECK: Iterations: 1
+# CHECK-NEXT: Instructions: 6
+# CHECK-NEXT: Total Cycles: 8
+# CHECK-NEXT: Total uOps: 9
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.13
+# CHECK-NEXT: IPC: 0.75
+# CHECK-NEXT: Block RThroughput: 4.5
+
+# CHECK: Instruction Info:
+# CHECK-NEXT: [1]: #uOps
+# CHECK-NEXT: [2]: Latency
+# CHECK-NEXT: [3]: RThroughput
+# CHECK-NEXT: [4]: MayLoad
+# CHECK-NEXT: [5]: MayStore
+# CHECK-NEXT: [6]: HasSideEffects (U)
+
+# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: 3 4 2.00 * ldp w3, w5, [x10], #4
+# CHECK-NEXT: 1 3 0.50 add w10, w11, w12
+# CHECK-NEXT: 1 3 0.50 add w13, w14, w15
+# CHECK-NEXT: 2 4 2.00 * ldp w7, w8, [x11]
+# CHECK-NEXT: 1 3 0.50 add w16, w17, w18
+# CHECK-NEXT: 1 3 0.50 add w19, w20, w21
+
+# CHECK: Resources:
+# CHECK-NEXT: [0.0] - A53UnitALU
+# CHECK-NEXT: [0.1] - A53UnitALU
+# CHECK-NEXT: [1] - A53UnitB
+# CHECK-NEXT: [2] - A53UnitDiv
+# CHECK-NEXT: [3] - A53UnitFPALU
+# CHECK-NEXT: [4] - A53UnitFPMDS
+# CHECK-NEXT: [5] - A53UnitLdSt
+# CHECK-NEXT: [6] - A53UnitMAC
+
+# CHECK: Resource pressure per iteration:
+# CHECK-NEXT: [0.0] [0.1] [1] [2] [3] [4] [5] [6]
+# CHECK-NEXT: 2.00 2.00 - - - - 4.00 -
+
+# CHECK: Resource pressure by instruction:
+# CHECK-NEXT: [0.0] [0.1] [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: - - - - - - 2.00 - ldp w3, w5, [x10], #4
+# CHECK-NEXT: - 1.00 - - - - - - add w10, w11, w12
+# CHECK-NEXT: 1.00 - - - - - - - add w13, w14, w15
+# CHECK-NEXT: - - - - - - 2.00 - ldp w7, w8, [x11]
+# CHECK-NEXT: - 1.00 - - - - - - add w16, w17, w18
+# CHECK-NEXT: 1.00 - - - - - - - add w19, w20, w21
+
+# CHECK: Timeline view:
+# CHECK-NEXT: Index 01234567
+
+# CHECK: [0,0] DeeeE. . ldp w3, w5, [x10], #4
+# CHECK-NEXT: [0,1] .DeeE. . add w10, w11, w12
+# CHECK-NEXT: [0,2] . DeeE . add w13, w14, w15
+# CHECK-NEXT: [0,3] . DeeeE ldp w7, w8, [x11]
+# CHECK-NEXT: [0,4] . DeeE add w16, w17, w18
+# CHECK-NEXT: [0,5] . DeeE add w19, w20, w21
+
+# CHECK: Average Wait times (based on the timeline view):
+# CHECK-NEXT: [0]: Executions
+# CHECK-NEXT: [1]: Average time spent waiting in a scheduler's queue
+# CHECK-NEXT: [2]: Average time spent waiting in a scheduler's queue while ready
+# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
+
+# CHECK: [0] [1] [2] [3]
+# CHECK-NEXT: 0. 1 0.0 0.0 0.0 ldp w3, w5, [x10], #4
+# CHECK-NEXT: 1. 1 0.0 0.0 0.0 add w10, w11, w12
+# CHECK-NEXT: 2. 1 0.0 0.0 0.0 add w13, w14, w15
+# CHECK-NEXT: 3. 1 0.0 0.0 0.0 ldp w7, w8, [x11]
+# CHECK-NEXT: 4. 1 0.0 0.0 0.0 add w16, w17, w18
+# CHECK-NEXT: 5. 1 0.0 0.0 0.0 add w19, w20, w21
+# CHECK-NEXT: 1 0.0 0.0 0.0 <total>
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-add-sequence.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-add-sequence.s
index be817b755f77..dbcb3c53b22f 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-add-sequence.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-add-sequence.s
@@ -8,12 +8,12 @@ add w1, w0, #4
# CHECK: Iterations: 2
# CHECK-NEXT: Instructions: 8
-# CHECK-NEXT: Total Cycles: 10
+# CHECK-NEXT: Total Cycles: 9
# CHECK-NEXT: Total uOps: 8
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.80
-# CHECK-NEXT: IPC: 0.80
+# CHECK-NEXT: uOps Per Cycle: 0.89
+# CHECK-NEXT: IPC: 0.89
# CHECK-NEXT: Block RThroughput: 2.0
# CHECK: Instruction Info:
@@ -56,16 +56,16 @@ add w1, w0, #4
# CHECK-NEXT: 1.00 - - - - - - - - - - - add w1, w0, #4
# CHECK: Timeline view:
-# CHECK-NEXT: Index 0123456789
+# CHECK-NEXT: Index 012345678
-# CHECK: [0,0] DeeER. . add w2, w3, #1
-# CHECK-NEXT: [0,1] DeeER. . add w4, w3, #2, lsl #12
-# CHECK-NEXT: [0,2] .DeeER . add w0, w4, #3
-# CHECK-NEXT: [0,3] . DeeER . add w1, w0, #4
-# CHECK-NEXT: [1,0] . DeeER . add w2, w3, #1
-# CHECK-NEXT: [1,1] . DeeER . add w4, w3, #2, lsl #12
-# CHECK-NEXT: [1,2] . DeeER. add w0, w4, #3
-# CHECK-NEXT: [1,3] . DeeER add w1, w0, #4
+# CHECK: [0,0] DeeE . . add w2, w3, #1
+# CHECK-NEXT: [0,1] DeeE . . add w4, w3, #2, lsl #12
+# CHECK-NEXT: [0,2] .DeeE. . add w0, w4, #3
+# CHECK-NEXT: [0,3] . DeeE . add w1, w0, #4
+# CHECK-NEXT: [1,0] . DeeE . add w2, w3, #1
+# CHECK-NEXT: [1,1] . DeeE . add w4, w3, #2, lsl #12
+# CHECK-NEXT: [1,2] . DeeE. add w0, w4, #3
+# CHECK-NEXT: [1,3] . DeeE add w1, w0, #4
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-stats.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-stats.s
index a672c8c879ae..9081fb525ee2 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-stats.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-stats.s
@@ -10,12 +10,12 @@ str w0, [x21, x18, lsl #2]
# CHECK: Iterations: 2
# CHECK-NEXT: Instructions: 12
-# CHECK-NEXT: Total Cycles: 21
+# CHECK-NEXT: Total Cycles: 20
# CHECK-NEXT: Total uOps: 14
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.67
-# CHECK-NEXT: IPC: 0.57
+# CHECK-NEXT: uOps Per Cycle: 0.70
+# CHECK-NEXT: IPC: 0.60
# CHECK-NEXT: Block RThroughput: 3.5
# CHECK: Instruction Info:
@@ -35,7 +35,7 @@ str w0, [x21, x18, lsl #2]
# CHECK-NEXT: 1 4 1.00 * str w0, [x21, x18, lsl #2]
# CHECK: Dynamic Dispatch Stall Cycles:
-# CHECK-NEXT: RAT - Register unavailable: 8 (38.1%)
+# CHECK-NEXT: RAT - Register unavailable: 8 (40.0%)
# CHECK-NEXT: RCU - Retire tokens unavailable: 0
# CHECK-NEXT: SCHEDQ - Scheduler full: 0
# CHECK-NEXT: LQ - Load queue full: 0
@@ -44,33 +44,22 @@ str w0, [x21, x18, lsl #2]
# CHECK: Dispatch Logic - number of cycles where we saw N micro opcodes dispatched:
# CHECK-NEXT: [# dispatched], [# cycles]
-# CHECK-NEXT: 0, 11 (52.4%)
-# CHECK-NEXT: 1, 6 (28.6%)
-# CHECK-NEXT: 2, 4 (19.0%)
+# CHECK-NEXT: 0, 10 (50.0%)
+# CHECK-NEXT: 1, 6 (30.0%)
+# CHECK-NEXT: 2, 4 (20.0%)
# CHECK: Schedulers - number of cycles where we saw N micro opcodes issued:
# CHECK-NEXT: [# issued], [# cycles]
-# CHECK-NEXT: 0, 11 (52.4%)
-# CHECK-NEXT: 1, 6 (28.6%)
-# CHECK-NEXT: 2, 4 (19.0%)
+# CHECK-NEXT: 0, 10 (50.0%)
+# CHECK-NEXT: 1, 6 (30.0%)
+# CHECK-NEXT: 2, 4 (20.0%)
# CHECK: Scheduler's queue usage:
# CHECK-NEXT: No scheduler resources used.
-# CHECK: Retire Control Unit - number of cycles where we saw N instructions retired:
-# CHECK-NEXT: [# retired], [# cycles]
-# CHECK-NEXT: 0, 14 (66.7%)
-# CHECK-NEXT: 1, 4 (19.0%)
-# CHECK-NEXT: 2, 1 (4.8%)
-# CHECK-NEXT: 3, 2 (9.5%)
-
-# CHECK: Total ROB Entries: 64
-# CHECK-NEXT: Max Used ROB Entries: 6 ( 9.4% )
-# CHECK-NEXT: Average Used ROB Entries per cy: 2 ( 3.1% )
-
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 14
-# CHECK-NEXT: Max number of mappings used: 6
+# CHECK-NEXT: Max number of mappings used: 4
# CHECK: Resources:
# CHECK-NEXT: [0.0] - CortexA55UnitALU
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-views.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-views.s
index 1d4e41a63c63..d49e68adc1c3 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-views.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-all-views.s
@@ -10,12 +10,12 @@ str w0, [x21, x18, lsl #2]
# CHECK: Iterations: 2
# CHECK-NEXT: Instructions: 12
-# CHECK-NEXT: Total Cycles: 21
+# CHECK-NEXT: Total Cycles: 20
# CHECK-NEXT: Total uOps: 14
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.67
-# CHECK-NEXT: IPC: 0.57
+# CHECK-NEXT: uOps Per Cycle: 0.70
+# CHECK-NEXT: IPC: 0.60
# CHECK-NEXT: Block RThroughput: 3.5
# CHECK: Instruction Info:
@@ -35,7 +35,7 @@ str w0, [x21, x18, lsl #2]
# CHECK-NEXT: 1 4 1.00 * str w0, [x21, x18, lsl #2]
# CHECK: Dynamic Dispatch Stall Cycles:
-# CHECK-NEXT: RAT - Register unavailable: 8 (38.1%)
+# CHECK-NEXT: RAT - Register unavailable: 8 (40.0%)
# CHECK-NEXT: RCU - Retire tokens unavailable: 0
# CHECK-NEXT: SCHEDQ - Scheduler full: 0
# CHECK-NEXT: LQ - Load queue full: 0
@@ -44,33 +44,22 @@ str w0, [x21, x18, lsl #2]
# CHECK: Dispatch Logic - number of cycles where we saw N micro opcodes dispatched:
# CHECK-NEXT: [# dispatched], [# cycles]
-# CHECK-NEXT: 0, 11 (52.4%)
-# CHECK-NEXT: 1, 6 (28.6%)
-# CHECK-NEXT: 2, 4 (19.0%)
+# CHECK-NEXT: 0, 10 (50.0%)
+# CHECK-NEXT: 1, 6 (30.0%)
+# CHECK-NEXT: 2, 4 (20.0%)
# CHECK: Schedulers - number of cycles where we saw N micro opcodes issued:
# CHECK-NEXT: [# issued], [# cycles]
-# CHECK-NEXT: 0, 11 (52.4%)
-# CHECK-NEXT: 1, 6 (28.6%)
-# CHECK-NEXT: 2, 4 (19.0%)
+# CHECK-NEXT: 0, 10 (50.0%)
+# CHECK-NEXT: 1, 6 (30.0%)
+# CHECK-NEXT: 2, 4 (20.0%)
# CHECK: Scheduler's queue usage:
# CHECK-NEXT: No scheduler resources used.
-# CHECK: Retire Control Unit - number of cycles where we saw N instructions retired:
-# CHECK-NEXT: [# retired], [# cycles]
-# CHECK-NEXT: 0, 14 (66.7%)
-# CHECK-NEXT: 1, 4 (19.0%)
-# CHECK-NEXT: 2, 1 (4.8%)
-# CHECK-NEXT: 3, 2 (9.5%)
-
-# CHECK: Total ROB Entries: 64
-# CHECK-NEXT: Max Used ROB Entries: 6 ( 9.4% )
-# CHECK-NEXT: Average Used ROB Entries per cy: 2 ( 3.1% )
-
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 14
-# CHECK-NEXT: Max number of mappings used: 6
+# CHECK-NEXT: Max number of mappings used: 4
# CHECK: Resources:
# CHECK-NEXT: [0.0] - CortexA55UnitALU
@@ -101,20 +90,20 @@ str w0, [x21, x18, lsl #2]
# CHECK: Timeline view:
# CHECK-NEXT: 0123456789
-# CHECK-NEXT: Index 0123456789 0
-
-# CHECK: [0,0] DeeER. . . . ldr w4, [x2], #4
-# CHECK-NEXT: [0,1] .DeeER . . . ldr w5, [x3]
-# CHECK-NEXT: [0,2] . DeeeER. . . madd w0, w5, w4, w0
-# CHECK-NEXT: [0,3] . DeeER. . . add x3, x3, x13
-# CHECK-NEXT: [0,4] . DeeER. . . subs x1, x1, #1
-# CHECK-NEXT: [0,5] . . DeeeER . . str w0, [x21, x18, lsl #2]
-# CHECK-NEXT: [1,0] . . DeeER . . ldr w4, [x2], #4
-# CHECK-NEXT: [1,1] . . DeeER . . ldr w5, [x3]
-# CHECK-NEXT: [1,2] . . . DeeeER . madd w0, w5, w4, w0
-# CHECK-NEXT: [1,3] . . . DeeER . add x3, x3, x13
-# CHECK-NEXT: [1,4] . . . DeeER . subs x1, x1, #1
-# CHECK-NEXT: [1,5] . . . DeeeER str w0, [x21, x18, lsl #2]
+# CHECK-NEXT: Index 0123456789
+
+# CHECK: [0,0] DeeE . . . . ldr w4, [x2], #4
+# CHECK-NEXT: [0,1] .DeeE. . . . ldr w5, [x3]
+# CHECK-NEXT: [0,2] . DeeeE . . . madd w0, w5, w4, w0
+# CHECK-NEXT: [0,3] . DeeE . . . add x3, x3, x13
+# CHECK-NEXT: [0,4] . DeeE . . . subs x1, x1, #1
+# CHECK-NEXT: [0,5] . . DeeeE . . str w0, [x21, x18, lsl #2]
+# CHECK-NEXT: [1,0] . . DeeE . . ldr w4, [x2], #4
+# CHECK-NEXT: [1,1] . . DeeE . . ldr w5, [x3]
+# CHECK-NEXT: [1,2] . . . DeeeE . madd w0, w5, w4, w0
+# CHECK-NEXT: [1,3] . . . DeeE . add x3, x3, x13
+# CHECK-NEXT: [1,4] . . . DeeE . subs x1, x1, #1
+# CHECK-NEXT: [1,5] . . . DeeeE str w0, [x21, x18, lsl #2]
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-in-order-retire.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-in-order-retire.s
index de5dbaa3490c..c35332420549 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-in-order-retire.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-in-order-retire.s
@@ -10,12 +10,12 @@ add w7, w9, w0
# CHECK: Iterations: 2
# CHECK-NEXT: Instructions: 12
-# CHECK-NEXT: Total Cycles: 20
+# CHECK-NEXT: Total Cycles: 19
# CHECK-NEXT: Total uOps: 12
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.60
-# CHECK-NEXT: IPC: 0.60
+# CHECK-NEXT: uOps Per Cycle: 0.63
+# CHECK-NEXT: IPC: 0.63
# CHECK-NEXT: Block RThroughput: 8.0
# CHECK: Instruction Info:
@@ -40,37 +40,26 @@ add w7, w9, w0
# CHECK-NEXT: SCHEDQ - Scheduler full: 0
# CHECK-NEXT: LQ - Load queue full: 0
# CHECK-NEXT: SQ - Store queue full: 0
-# CHECK-NEXT: GROUP - Static restrictions on the dispatch group: 1 (5.0%)
+# CHECK-NEXT: GROUP - Static restrictions on the dispatch group: 1 (5.3%)
# CHECK: Dispatch Logic - number of cycles where we saw N micro opcodes dispatched:
# CHECK-NEXT: [# dispatched], [# cycles]
-# CHECK-NEXT: 0, 12 (60.0%)
-# CHECK-NEXT: 1, 4 (20.0%)
-# CHECK-NEXT: 2, 4 (20.0%)
+# CHECK-NEXT: 0, 11 (57.9%)
+# CHECK-NEXT: 1, 4 (21.1%)
+# CHECK-NEXT: 2, 4 (21.1%)
# CHECK: Schedulers - number of cycles where we saw N micro opcodes issued:
# CHECK-NEXT: [# issued], [# cycles]
-# CHECK-NEXT: 0, 12 (60.0%)
-# CHECK-NEXT: 1, 4 (20.0%)
-# CHECK-NEXT: 2, 4 (20.0%)
+# CHECK-NEXT: 0, 11 (57.9%)
+# CHECK-NEXT: 1, 4 (21.1%)
+# CHECK-NEXT: 2, 4 (21.1%)
# CHECK: Scheduler's queue usage:
# CHECK-NEXT: No scheduler resources used.
-# CHECK: Retire Control Unit - number of cycles where we saw N instructions retired:
-# CHECK-NEXT: [# retired], [# cycles]
-# CHECK-NEXT: 0, 14 (70.0%)
-# CHECK-NEXT: 1, 2 (10.0%)
-# CHECK-NEXT: 2, 2 (10.0%)
-# CHECK-NEXT: 3, 2 (10.0%)
-
-# CHECK: Total ROB Entries: 64
-# CHECK-NEXT: Max Used ROB Entries: 7 ( 10.9% )
-# CHECK-NEXT: Average Used ROB Entries per cy: 2 ( 3.1% )
-
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 12
-# CHECK-NEXT: Max number of mappings used: 7
+# CHECK-NEXT: Max number of mappings used: 6
# CHECK: Resources:
# CHECK-NEXT: [0.0] - CortexA55UnitALU
@@ -100,21 +89,21 @@ add w7, w9, w0
# CHECK-NEXT: 0.50 0.50 - - - - - - - - - - add w7, w9, w0
# CHECK: Timeline view:
-# CHECK-NEXT: 0123456789
+# CHECK-NEXT: 012345678
# CHECK-NEXT: Index 0123456789
-# CHECK: [0,0] DeeeeeeeER. . . sdiv w12, w21, w0
-# CHECK-NEXT: [0,1] . DeeER. . . add w8, w8, #1
-# CHECK-NEXT: [0,2] . DeeER. . . add w1, w2, w0
-# CHECK-NEXT: [0,3] . .DeeER . . add w3, w4, #1
-# CHECK-NEXT: [0,4] . .DeeER . . add w5, w6, w0
-# CHECK-NEXT: [0,5] . . DeeER . . add w7, w9, w0
-# CHECK-NEXT: [1,0] . . DeeeeeeeER . sdiv w12, w21, w0
-# CHECK-NEXT: [1,1] . . . DeeER . add w8, w8, #1
-# CHECK-NEXT: [1,2] . . . DeeER . add w1, w2, w0
-# CHECK-NEXT: [1,3] . . . DeeER. add w3, w4, #1
-# CHECK-NEXT: [1,4] . . . DeeER. add w5, w6, w0
-# CHECK-NEXT: [1,5] . . . DeeER add w7, w9, w0
+# CHECK: [0,0] DeeeeeeeE . . . sdiv w12, w21, w0
+# CHECK-NEXT: [0,1] . DeeE . . . add w8, w8, #1
+# CHECK-NEXT: [0,2] . DeeE . . . add w1, w2, w0
+# CHECK-NEXT: [0,3] . .DeeE. . . add w3, w4, #1
+# CHECK-NEXT: [0,4] . .DeeE. . . add w5, w6, w0
+# CHECK-NEXT: [0,5] . . DeeE . . add w7, w9, w0
+# CHECK-NEXT: [1,0] . . DeeeeeeeE . sdiv w12, w21, w0
+# CHECK-NEXT: [1,1] . . . DeeE . add w8, w8, #1
+# CHECK-NEXT: [1,2] . . . DeeE . add w1, w2, w0
+# CHECK-NEXT: [1,3] . . . DeeE. add w3, w4, #1
+# CHECK-NEXT: [1,4] . . . DeeE. add w5, w6, w0
+# CHECK-NEXT: [1,5] . . . DeeE add w7, w9, w0
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-out-of-order-retire.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-out-of-order-retire.s
index 6231116f25ac..8935d254cd98 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-out-of-order-retire.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/A55-out-of-order-retire.s
@@ -10,12 +10,12 @@ add w7, w9, w0
# CHECK: Iterations: 2
# CHECK-NEXT: Instructions: 12
-# CHECK-NEXT: Total Cycles: 25
+# CHECK-NEXT: Total Cycles: 24
# CHECK-NEXT: Total uOps: 12
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.48
-# CHECK-NEXT: IPC: 0.48
+# CHECK-NEXT: uOps Per Cycle: 0.50
+# CHECK-NEXT: IPC: 0.50
# CHECK-NEXT: Block RThroughput: 10.0
# CHECK: Instruction Info:
@@ -40,31 +40,21 @@ add w7, w9, w0
# CHECK-NEXT: SCHEDQ - Scheduler full: 0
# CHECK-NEXT: LQ - Load queue full: 0
# CHECK-NEXT: SQ - Store queue full: 0
-# CHECK-NEXT: GROUP - Static restrictions on the dispatch group: 7 (28.0%)
+# CHECK-NEXT: GROUP - Static restrictions on the dispatch group: 7 (29.2%)
# CHECK: Dispatch Logic - number of cycles where we saw N micro opcodes dispatched:
# CHECK-NEXT: [# dispatched], [# cycles]
-# CHECK-NEXT: 0, 19 (76.0%)
-# CHECK-NEXT: 2, 6 (24.0%)
+# CHECK-NEXT: 0, 18 (75.0%)
+# CHECK-NEXT: 2, 6 (25.0%)
# CHECK: Schedulers - number of cycles where we saw N micro opcodes issued:
# CHECK-NEXT: [# issued], [# cycles]
-# CHECK-NEXT: 0, 19 (76.0%)
-# CHECK-NEXT: 2, 6 (24.0%)
+# CHECK-NEXT: 0, 18 (75.0%)
+# CHECK-NEXT: 2, 6 (25.0%)
# CHECK: Scheduler's queue usage:
# CHECK-NEXT: No scheduler resources used.
-# CHECK: Retire Control Unit - number of cycles where we saw N instructions retired:
-# CHECK-NEXT: [# retired], [# cycles]
-# CHECK-NEXT: 0, 18 (72.0%)
-# CHECK-NEXT: 1, 2 (8.0%)
-# CHECK-NEXT: 2, 5 (20.0%)
-
-# CHECK: Total ROB Entries: 64
-# CHECK-NEXT: Max Used ROB Entries: 7 ( 10.9% )
-# CHECK-NEXT: Average Used ROB Entries per cy: 2 ( 3.1% )
-
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 12
# CHECK-NEXT: Max number of mappings used: 7
@@ -98,20 +88,20 @@ add w7, w9, w0
# CHECK: Timeline view:
# CHECK-NEXT: 0123456789
-# CHECK-NEXT: Index 0123456789 01234
-
-# CHECK: [0,0] DeeeeeeeeeeeeER. . . fdiv s1, s2, s3
-# CHECK-NEXT: [0,1] DeeER. . . . . add w8, w8, #1
-# CHECK-NEXT: [0,2] .DeeER . . . . add w1, w2, w0
-# CHECK-NEXT: [0,3] .DeeER . . . . add w3, w4, #1
-# CHECK-NEXT: [0,4] . DeeER . . . . add w5, w6, w0
-# CHECK-NEXT: [0,5] . DeeER . . . . add w7, w9, w0
-# CHECK-NEXT: [1,0] . . DeeeeeeeeeeeeER fdiv s1, s2, s3
-# CHECK-NEXT: [1,1] . . DeeER. . . add w8, w8, #1
-# CHECK-NEXT: [1,2] . . .DeeER . . add w1, w2, w0
-# CHECK-NEXT: [1,3] . . .DeeER . . add w3, w4, #1
-# CHECK-NEXT: [1,4] . . . DeeER . . add w5, w6, w0
-# CHECK-NEXT: [1,5] . . . DeeER . . add w7, w9, w0
+# CHECK-NEXT: Index 0123456789 0123
+
+# CHECK: [0,0] DeeeeeeeeeeeeE . . . fdiv s1, s2, s3
+# CHECK-NEXT: [0,1] DeeE . . . . . add w8, w8, #1
+# CHECK-NEXT: [0,2] .DeeE. . . . . add w1, w2, w0
+# CHECK-NEXT: [0,3] .DeeE. . . . . add w3, w4, #1
+# CHECK-NEXT: [0,4] . DeeE . . . . add w5, w6, w0
+# CHECK-NEXT: [0,5] . DeeE . . . . add w7, w9, w0
+# CHECK-NEXT: [1,0] . . DeeeeeeeeeeeeE fdiv s1, s2, s3
+# CHECK-NEXT: [1,1] . . DeeE . . . add w8, w8, #1
+# CHECK-NEXT: [1,2] . . .DeeE. . . add w1, w2, w0
+# CHECK-NEXT: [1,3] . . .DeeE. . . add w3, w4, #1
+# CHECK-NEXT: [1,4] . . . DeeE . . add w5, w6, w0
+# CHECK-NEXT: [1,5] . . . DeeE . . add w7, w9, w0
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-0-single-add.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-0-single-add.s
new file mode 100644
index 000000000000..4bb6d44393f7
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-0-single-add.s
@@ -0,0 +1,14 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+add w8, w8, #1
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 1000
+# CHECK-NEXT: Total Cycles: 1003
+# CHECK-NEXT: Total uOps: 1000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.00
+# CHECK-NEXT: IPC: 1.00
+# CHECK-NEXT: Block RThroughput: 0.5
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-1-add-seq.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-1-add-seq.s
new file mode 100644
index 000000000000..5ef72ee08e7b
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-1-add-seq.s
@@ -0,0 +1,15 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+add w8, w8, #1
+add w9, w9, #1
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 2000
+# CHECK-NEXT: Total Cycles: 1003
+# CHECK-NEXT: Total uOps: 2000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.99
+# CHECK-NEXT: IPC: 1.99
+# CHECK-NEXT: Block RThroughput: 1.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-10-fma.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-10-fma.s
new file mode 100644
index 000000000000..2f892c54abbb
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-10-fma.s
@@ -0,0 +1,15 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+fmadd s3, s5, s6, s7
+fmadd s8, s9, s10, s11
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 2000
+# CHECK-NEXT: Total Cycles: 1004
+# CHECK-NEXT: Total uOps: 2000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.99
+# CHECK-NEXT: IPC: 1.99
+# CHECK-NEXT: Block RThroughput: 1.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-11-fma-mix.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-11-fma-mix.s
new file mode 100644
index 000000000000..b9489852a926
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-11-fma-mix.s
@@ -0,0 +1,19 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+# FMADD writes and retires out-of-order
+fmadd s3, s5, s6, s7
+# ADD instructions are issued and retire in-order
+add w8, w8, #1
+add w9, w9, #1
+add w10, w10, #1
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 4000
+# CHECK-NEXT: Total Cycles: 2003
+# CHECK-NEXT: Total uOps: 4000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 2.00
+# CHECK-NEXT: IPC: 2.00
+# CHECK-NEXT: Block RThroughput: 2.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-2-skewed-alu.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-2-skewed-alu.s
new file mode 100644
index 000000000000..ba18c8f2bf40
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-2-skewed-alu.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+# CHECK: IPC:
+# CHECK-SAME: 2.00
+#
+# XFAIL: *
+#
+# Cortex-A55 has a secondary skewed ALU in the Ex1 stage for simple
+# ALU instructions that do not require shifting or saturation
+# resources. Results from the skewed ALU are available 1 cycle earlier.
+#
+# This features allows the first and the second instruction to be
+# dual-issued despite a register dependency (w8).
+#
+# MCA and LLVM scheduling model do not support this yet.
+
+add w8, w8, #1
+add w10, w8, #1
+add w12, w8, #1
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-3-mul.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-3-mul.s
new file mode 100644
index 000000000000..e029b05617e0
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-3-mul.s
@@ -0,0 +1,16 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+add w8, w8, #1
+add w12, w8, #1
+mul w10, w10, w10
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 3000
+# CHECK-NEXT: Total Cycles: 3003
+# CHECK-NEXT: Total uOps: 3000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.00
+# CHECK-NEXT: IPC: 1.00
+# CHECK-NEXT: Block RThroughput: 1.5
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-4-sdiv.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-4-sdiv.s
new file mode 100644
index 000000000000..b7b7a510b9b1
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-4-sdiv.s
@@ -0,0 +1,21 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+# DIV is not modeled precisely: on hardware it takes variable
+# number of cycles depending on its operands, but LLVM scheduling
+# model only provides an average latency.
+
+add w8, w8, #1
+movz w10, #1, lsl #16
+movz w12, #32768, lsl #16
+sdiv w10, w12, w10
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 4000
+# CHECK-NEXT: Total Cycles: 8004
+# CHECK-NEXT: Total uOps: 4000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 0.50
+# CHECK-NEXT: IPC: 0.50
+# CHECK-NEXT: Block RThroughput: 8.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-5-mul-sdiv.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-5-mul-sdiv.s
new file mode 100644
index 000000000000..37d1829e2b47
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-5-mul-sdiv.s
@@ -0,0 +1,22 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+# DIV is not modeled precisely: on hardware it takes variable
+# number of cycles depending on its operands. LLVM scheduling model
+# only provides an average latency.
+
+add w8, w8, #1
+movz w10, #1, lsl #16
+movz w12, #32768, lsl #16
+mul w11, w8, w8
+sdiv w10, w12, w10
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 5000
+# CHECK-NEXT: Total Cycles: 8004
+# CHECK-NEXT: Total uOps: 5000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 0.62
+# CHECK-NEXT: IPC: 0.62
+# CHECK-NEXT: Block RThroughput: 8.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-6-mul.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-6-mul.s
new file mode 100644
index 000000000000..95b40264f9e1
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-6-mul.s
@@ -0,0 +1,25 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+# It appears that ADD and MUL fuse together, if both can be issued in
+# one cycle:
+#
+# add w12, w8, #1
+# mul w10, w12, w10
+#
+# FIXME: MCA (and LLVM scheduling model) do not support this. The test
+# case uses different registers to break the pattern.
+
+add w8, w8, #1
+add w13, w8, #1
+mul w10, w12, w10
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 3000
+# CHECK-NEXT: Total Cycles: 3003
+# CHECK-NEXT: Total uOps: 3000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.00
+# CHECK-NEXT: IPC: 1.00
+# CHECK-NEXT: Block RThroughput: 1.5
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-7-cmp.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-7-cmp.s
new file mode 100644
index 000000000000..024834d97e09
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-7-cmp.s
@@ -0,0 +1,17 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+add w8, w8, #1
+add w12, w9, #1
+cmp w9, #42
+mul w10, w12, w10
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 4000
+# CHECK-NEXT: Total Cycles: 3004
+# CHECK-NEXT: Total uOps: 4000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.33
+# CHECK-NEXT: IPC: 1.33
+# CHECK-NEXT: Block RThroughput: 2.0
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-8-ldr.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-8-ldr.s
new file mode 100644
index 000000000000..52bd9b0968a8
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-8-ldr.s
@@ -0,0 +1,19 @@
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+# CHECK: IPC:
+# CHECK-SAME: 1.50
+#
+# XFAIL: *
+#
+# MCA reports IPC = 0.60, while hardware shows IPC = 1.50.
+#
+# 1) The skewed ALU on Cortex-A55 is not modeled: ADD and AND
+# instructions should be issued in the same cycle.
+# See A55-2.s test for more details.
+#
+# 2) Cortex-A55 manual mentions that there is a forwarding path from
+# the ALU pipeline to the LD/ST pipeline. This is not implemented in
+# the LLVM scheduling model.
+
+add w8, w8, #1
+and w12, w8, #0x3f
+ldr w14, [x10, w12, uxtw #2]
diff --git a/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-9-fabs.s b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-9-fabs.s
new file mode 100644
index 000000000000..b23660128284
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AArch64/Cortex/IPC/A55-9-fabs.s
@@ -0,0 +1,15 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=aarch64 -mcpu=cortex-a55 --all-views=false --summary-view --iterations=1000 < %s | FileCheck %s
+
+fabs s0, s1
+fabs s2, s3
+
+# CHECK: Iterations: 1000
+# CHECK-NEXT: Instructions: 2000
+# CHECK-NEXT: Total Cycles: 1004
+# CHECK-NEXT: Total uOps: 2000
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 1.99
+# CHECK-NEXT: IPC: 1.99
+# CHECK-NEXT: Block RThroughput: 1.0
diff --git a/llvm/test/tools/llvm-mca/AMDGPU/gfx10-add-sequence.s b/llvm/test/tools/llvm-mca/AMDGPU/gfx10-add-sequence.s
index 64ee3bdc8355..be57731389ba 100644
--- a/llvm/test/tools/llvm-mca/AMDGPU/gfx10-add-sequence.s
+++ b/llvm/test/tools/llvm-mca/AMDGPU/gfx10-add-sequence.s
@@ -7,12 +7,12 @@ v_add_f32 v2, v1, v0
# CHECK: Iterations: 1
# CHECK-NEXT: Instructions: 3
-# CHECK-NEXT: Total Cycles: 13
+# CHECK-NEXT: Total Cycles: 12
# CHECK-NEXT: Total uOps: 3
# CHECK: Dispatch Width: 1
-# CHECK-NEXT: uOps Per Cycle: 0.23
-# CHECK-NEXT: IPC: 0.23
+# CHECK-NEXT: uOps Per Cycle: 0.25
+# CHECK-NEXT: IPC: 0.25
# CHECK-NEXT: Block RThroughput: 3.0
# CHECK: Instruction Info:
@@ -48,12 +48,12 @@ v_add_f32 v2, v1, v0
# CHECK-NEXT: - - - 1.00 - 1.00 - v_add_f32_e32 v2, v1, v0
# CHECK: Timeline view:
-# CHECK-NEXT: 012
+# CHECK-NEXT: 01
# CHECK-NEXT: Index 0123456789
-# CHECK: [0,0] DeeeeER . . v_add_f32_e32 v0, v0, v0
-# CHECK-NEXT: [0,1] .DeeeeER . . v_add_f32_e32 v1, v1, v1
-# CHECK-NEXT: [0,2] . .DeeeeER v_add_f32_e32 v2, v1, v0
+# CHECK: [0,0] DeeeeE .. v_add_f32_e32 v0, v0, v0
+# CHECK-NEXT: [0,1] .DeeeeE .. v_add_f32_e32 v1, v1, v1
+# CHECK-NEXT: [0,2] . .DeeeeE v_add_f32_e32 v2, v1, v0
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/AMDGPU/gfx10-double.s b/llvm/test/tools/llvm-mca/AMDGPU/gfx10-double.s
new file mode 100644
index 000000000000..3a0991d875f6
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/AMDGPU/gfx10-double.s
@@ -0,0 +1,187 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=amdgcn -mcpu=gfx1010 --timeline --iterations=1 < %s | FileCheck %s
+
+v_cvt_i32_f64 v0, v[0:1]
+v_cvt_f64_i32 v[2:3], v2
+v_cvt_f32_f64 v4, v[4:5]
+v_cvt_f64_f32 v[6:7], v6
+v_cvt_u32_f64 v8, v[8:9]
+v_cvt_f64_u32 v[10:11], v10
+
+v_frexp_exp_i32_f64 v0, v[0:1]
+v_frexp_mant_f64 v[2:3], v[2:3]
+v_fract_f64 v[4:5], v[4:5]
+
+v_trunc_f64 v[0:1], v[0:1]
+v_ceil_f64 v[2:3], v[2:3]
+v_rndne_f64 v[4:5], v[4:5]
+v_floor_f64 v[6:7], v[6:7]
+
+v_fma_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+v_add_f64 v[2:3], v[2:3], v[2:3]
+v_mul_f64 v[4:5], v[4:5], v[4:5]
+v_min_f64 v[6:7], v[6:7], v[6:7]
+v_max_f64 v[8:9], v[8:9], v[8:9]
+
+v_div_fmas_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+
+v_div_fixup_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+v_ldexp_f64 v[2:3], v[2:3], v0
+
+v_div_scale_f64 v[0:1], vcc_lo, v[0:1], v[0:1], v[0:1]
+
+v_trig_preop_f64 v[2:3], v[2:3], v0
+
+v_cmp_eq_f64 v[0:1], v[0:1]
+v_cmp_class_f64 vcc_lo, v[2:3], s0
+
+v_rcp_f64 v[0:1], v[0:1]
+v_rsq_f64 v[2:3], v[2:3]
+v_sqrt_f64 v[4:5], v[4:5]
+
+# CHECK: Iterations: 1
+# CHECK-NEXT: Instructions: 28
+# CHECK-NEXT: Total Cycles: 224
+# CHECK-NEXT: Total uOps: 29
+
+# CHECK: Dispatch Width: 1
+# CHECK-NEXT: uOps Per Cycle: 0.13
+# CHECK-NEXT: IPC: 0.13
+# CHECK-NEXT: Block RThroughput: 29.0
+
+# CHECK: Instruction Info:
+# CHECK-NEXT: [1]: #uOps
+# CHECK-NEXT: [2]: Latency
+# CHECK-NEXT: [3]: RThroughput
+# CHECK-NEXT: [4]: MayLoad
+# CHECK-NEXT: [5]: MayStore
+# CHECK-NEXT: [6]: HasSideEffects (U)
+
+# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: 1 22 1.00 U v_cvt_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_cvt_f64_i32_e32 v[2:3], v2
+# CHECK-NEXT: 1 22 1.00 U v_cvt_f32_f64_e32 v4, v[4:5]
+# CHECK-NEXT: 1 22 1.00 U v_cvt_f64_f32_e32 v[6:7], v6
+# CHECK-NEXT: 1 22 1.00 U v_cvt_u32_f64_e32 v8, v[8:9]
+# CHECK-NEXT: 1 22 1.00 U v_cvt_f64_u32_e32 v[10:11], v10
+# CHECK-NEXT: 1 22 1.00 U v_frexp_exp_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_frexp_mant_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 1 22 1.00 U v_fract_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: 1 22 1.00 U v_trunc_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_ceil_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 1 22 1.00 U v_rndne_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: 1 22 1.00 U v_floor_f64_e32 v[6:7], v[6:7]
+# CHECK-NEXT: 1 22 1.00 U v_fma_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_add_f64 v[2:3], v[2:3], v[2:3]
+# CHECK-NEXT: 1 22 1.00 U v_mul_f64 v[4:5], v[4:5], v[4:5]
+# CHECK-NEXT: 1 22 1.00 U v_min_f64 v[6:7], v[6:7], v[6:7]
+# CHECK-NEXT: 1 22 1.00 U v_max_f64 v[8:9], v[8:9], v[8:9]
+# CHECK-NEXT: 1 22 1.00 U v_div_fmas_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_div_fixup_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_ldexp_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: 2 22 2.00 U v_div_scale_f64 v[0:1], vcc_lo, v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_trig_preop_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: 1 22 1.00 U v_cmp_eq_f64_e32 vcc_lo, v[0:1], v[0:1]
+# CHECK-NEXT: 1 22 1.00 U v_cmp_class_f64_e64 vcc_lo, v[2:3], s0
+# CHECK-NEXT: 1 24 1.00 U v_rcp_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: 1 24 1.00 U v_rsq_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 1 24 1.00 U v_sqrt_f64_e32 v[4:5], v[4:5]
+
+# CHECK: Resources:
+# CHECK-NEXT: [0] - HWBranch
+# CHECK-NEXT: [1] - HWExport
+# CHECK-NEXT: [2] - HWLGKM
+# CHECK-NEXT: [3] - HWRC
+# CHECK-NEXT: [4] - HWSALU
+# CHECK-NEXT: [5] - HWVALU
+# CHECK-NEXT: [6] - HWVMEM
+
+# CHECK: Resource pressure per iteration:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6]
+# CHECK-NEXT: - - - 29.00 1.00 28.00 -
+
+# CHECK: Resource pressure by instruction:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_f64_i32_e32 v[2:3], v2
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_f32_f64_e32 v4, v[4:5]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_f64_f32_e32 v[6:7], v6
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_u32_f64_e32 v8, v[8:9]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cvt_f64_u32_e32 v[10:11], v10
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_frexp_exp_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_frexp_mant_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_fract_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_trunc_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_ceil_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_rndne_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_floor_f64_e32 v[6:7], v[6:7]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_fma_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_add_f64 v[2:3], v[2:3], v[2:3]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_mul_f64 v[4:5], v[4:5], v[4:5]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_min_f64 v[6:7], v[6:7], v[6:7]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_max_f64 v[8:9], v[8:9], v[8:9]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_div_fmas_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_div_fixup_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_ldexp_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: - - - 2.00 1.00 1.00 - v_div_scale_f64 v[0:1], vcc_lo, v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_trig_preop_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cmp_eq_f64_e32 vcc_lo, v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_cmp_class_f64_e64 vcc_lo, v[2:3], s0
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_rcp_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_rsq_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: - - - 1.00 - 1.00 - v_sqrt_f64_e32 v[4:5], v[4:5]
+
+# CHECK: Timeline view:
+# CHECK-NEXT: 0123456789 0123456789 0123456789 0
+# CHECK-NEXT: Index 0123456789 0123456789 0123456789 0123456789
+
+# CHECK: [0,0] DeeeeeeeeeeeeeeeeeeeeeE . . . . . . . . . . v_cvt_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: [0,1] .DeeeeeeeeeeeeeeeeeeeeeE . . . . . . . . . . v_cvt_f64_i32_e32 v[2:3], v2
+# CHECK-NEXT: [0,2] . DeeeeeeeeeeeeeeeeeeeeeE. . . . . . . . . . v_cvt_f32_f64_e32 v4, v[4:5]
+# CHECK-NEXT: [0,3] . DeeeeeeeeeeeeeeeeeeeeeE . . . . . . . . . v_cvt_f64_f32_e32 v[6:7], v6
+# CHECK-NEXT: [0,4] . DeeeeeeeeeeeeeeeeeeeeeE . . . . . . . . . v_cvt_u32_f64_e32 v8, v[8:9]
+# CHECK-NEXT: [0,5] . DeeeeeeeeeeeeeeeeeeeeeE . . . . . . . . . v_cvt_f64_u32_e32 v[10:11], v10
+# CHECK-NEXT: [0,6] . . . . . DeeeeeeeeeeeeeeeeeeeeeE. . . . . . v_frexp_exp_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: [0,7] . . . . . DeeeeeeeeeeeeeeeeeeeeeE . . . . . v_frexp_mant_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: [0,8] . . . . . DeeeeeeeeeeeeeeeeeeeeeE . . . . . v_fract_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: [0,9] . . . . . . . . . DeeeeeeeeeeeeeeeeeeeeeE . v_trunc_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: [0,10] . . . . . . . . . DeeeeeeeeeeeeeeeeeeeeeE . v_ceil_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: [0,11] . . . . . . . . . .DeeeeeeeeeeeeeeeeeeeeeE . v_rndne_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: [0,12] . . . . . . . . . . DeeeeeeeeeeeeeeeeeeeeeE. v_floor_f64_e32 v[6:7], v[6:7]
+
+# CHECK: Average Wait times (based on the timeline view):
+# CHECK-NEXT: [0]: Executions
+# CHECK-NEXT: [1]: Average time spent waiting in a scheduler's queue
+# CHECK-NEXT: [2]: Average time spent waiting in a scheduler's queue while ready
+# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
+
+# CHECK: [0] [1] [2] [3]
+# CHECK-NEXT: 0. 1 0.0 0.0 0.0 v_cvt_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: 1. 1 0.0 0.0 0.0 v_cvt_f64_i32_e32 v[2:3], v2
+# CHECK-NEXT: 2. 1 0.0 0.0 0.0 v_cvt_f32_f64_e32 v4, v[4:5]
+# CHECK-NEXT: 3. 1 0.0 0.0 0.0 v_cvt_f64_f32_e32 v[6:7], v6
+# CHECK-NEXT: 4. 1 0.0 0.0 0.0 v_cvt_u32_f64_e32 v8, v[8:9]
+# CHECK-NEXT: 5. 1 0.0 0.0 0.0 v_cvt_f64_u32_e32 v[10:11], v10
+# CHECK-NEXT: 6. 1 0.0 0.0 0.0 v_frexp_exp_i32_f64_e32 v0, v[0:1]
+# CHECK-NEXT: 7. 1 0.0 0.0 0.0 v_frexp_mant_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 8. 1 0.0 0.0 0.0 v_fract_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: 9. 1 0.0 0.0 0.0 v_trunc_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: 10. 1 0.0 0.0 0.0 v_ceil_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 11. 1 0.0 0.0 0.0 v_rndne_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: 12. 1 0.0 0.0 0.0 v_floor_f64_e32 v[6:7], v[6:7]
+# CHECK-NEXT: 13. 1 0.0 0.0 0.0 v_fma_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 14. 1 0.0 0.0 0.0 v_add_f64 v[2:3], v[2:3], v[2:3]
+# CHECK-NEXT: 15. 1 0.0 0.0 0.0 v_mul_f64 v[4:5], v[4:5], v[4:5]
+# CHECK-NEXT: 16. 1 0.0 0.0 0.0 v_min_f64 v[6:7], v[6:7], v[6:7]
+# CHECK-NEXT: 17. 1 0.0 0.0 0.0 v_max_f64 v[8:9], v[8:9], v[8:9]
+# CHECK-NEXT: 18. 1 0.0 0.0 0.0 v_div_fmas_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 19. 1 0.0 0.0 0.0 v_div_fixup_f64 v[0:1], v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 20. 1 0.0 0.0 0.0 v_ldexp_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: 21. 1 0.0 0.0 0.0 v_div_scale_f64 v[0:1], vcc_lo, v[0:1], v[0:1], v[0:1]
+# CHECK-NEXT: 22. 1 0.0 0.0 0.0 v_trig_preop_f64 v[2:3], v[2:3], v0
+# CHECK-NEXT: 23. 1 0.0 0.0 0.0 v_cmp_eq_f64_e32 vcc_lo, v[0:1], v[0:1]
+# CHECK-NEXT: 24. 1 0.0 0.0 0.0 v_cmp_class_f64_e64 vcc_lo, v[2:3], s0
+# CHECK-NEXT: 25. 1 0.0 0.0 0.0 v_rcp_f64_e32 v[0:1], v[0:1]
+# CHECK-NEXT: 26. 1 0.0 0.0 0.0 v_rsq_f64_e32 v[2:3], v[2:3]
+# CHECK-NEXT: 27. 1 0.0 0.0 0.0 v_sqrt_f64_e32 v[4:5], v[4:5]
+# CHECK-NEXT: 1 0.0 0.0 0.0 <total>
diff --git a/llvm/test/tools/llvm-mca/ARM/m7-negative-readadvance.s b/llvm/test/tools/llvm-mca/ARM/m7-negative-readadvance.s
index f195c069ef15..ad9a2b1ad0c2 100644
--- a/llvm/test/tools/llvm-mca/ARM/m7-negative-readadvance.s
+++ b/llvm/test/tools/llvm-mca/ARM/m7-negative-readadvance.s
@@ -9,12 +9,12 @@ vldr d0, [r1]
# CHECK: Iterations: 1
# CHECK-NEXT: Instructions: 3
-# CHECK-NEXT: Total Cycles: 7
+# CHECK-NEXT: Total Cycles: 6
# CHECK-NEXT: Total uOps: 3
# CHECK: Dispatch Width: 2
-# CHECK-NEXT: uOps Per Cycle: 0.43
-# CHECK-NEXT: IPC: 0.43
+# CHECK-NEXT: uOps Per Cycle: 0.50
+# CHECK-NEXT: IPC: 0.50
# CHECK-NEXT: Block RThroughput: 1.5
# CHECK: Instruction Info:
@@ -56,11 +56,11 @@ vldr d0, [r1]
# CHECK-NEXT: - - - - 1.00 - - - - - - - 2.00 vldr d0, [r1]
# CHECK: Timeline view:
-# CHECK-NEXT: Index 0123456
+# CHECK-NEXT: Index 012345
-# CHECK: [0,0] DER .. add.w r1, r1, #1
-# CHECK-NEXT: [0,1] .DER .. add.w r1, r1, #2
-# CHECK-NEXT: [0,2] . DeER vldr d0, [r1]
+# CHECK: [0,0] DE . add.w r1, r1, #1
+# CHECK-NEXT: [0,1] .DE . add.w r1, r1, #2
+# CHECK-NEXT: [0,2] . DeE vldr d0, [r1]
# CHECK: Average Wait times (based on the timeline view):
# CHECK-NEXT: [0]: Executions
diff --git a/llvm/test/tools/llvm-mca/X86/BtVer2/negative-read-advance.s b/llvm/test/tools/llvm-mca/X86/BtVer2/negative-read-advance.s
new file mode 100644
index 000000000000..de409e1c28d0
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/X86/BtVer2/negative-read-advance.s
@@ -0,0 +1,90 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=1 -timeline < %s | FileCheck %s
+
+add %ebx, %ebx
+vpinsrd $1, %ebx, %xmm0, %xmm1
+vpinsrd $1, %ebx, %xmm2, %xmm3
+vpinsrd $2, %ebx, %xmm4, %xmm5
+vpinsrd $2, %ebx, %xmm6, %xmm7
+vpinsrd $3, %ebx, %xmm8, %xmm10
+
+# CHECK: Iterations: 1
+# CHECK-NEXT: Instructions: 6
+# CHECK-NEXT: Total Cycles: 13
+# CHECK-NEXT: Total uOps: 11
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 0.85
+# CHECK-NEXT: IPC: 0.46
+# CHECK-NEXT: Block RThroughput: 5.5
+
+# CHECK: Instruction Info:
+# CHECK-NEXT: [1]: #uOps
+# CHECK-NEXT: [2]: Latency
+# CHECK-NEXT: [3]: RThroughput
+# CHECK-NEXT: [4]: MayLoad
+# CHECK-NEXT: [5]: MayStore
+# CHECK-NEXT: [6]: HasSideEffects (U)
+
+# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: 1 1 0.50 addl %ebx, %ebx
+# CHECK-NEXT: 2 7 0.50 vpinsrd $1, %ebx, %xmm0, %xmm1
+# CHECK-NEXT: 2 7 0.50 vpinsrd $1, %ebx, %xmm2, %xmm3
+# CHECK-NEXT: 2 7 0.50 vpinsrd $2, %ebx, %xmm4, %xmm5
+# CHECK-NEXT: 2 7 0.50 vpinsrd $2, %ebx, %xmm6, %xmm7
+# CHECK-NEXT: 2 7 0.50 vpinsrd $3, %ebx, %xmm8, %xmm10
+
+# CHECK: Resources:
+# CHECK-NEXT: [0] - JALU0
+# CHECK-NEXT: [1] - JALU1
+# CHECK-NEXT: [2] - JDiv
+# CHECK-NEXT: [3] - JFPA
+# CHECK-NEXT: [4] - JFPM
+# CHECK-NEXT: [5] - JFPU0
+# CHECK-NEXT: [6] - JFPU1
+# CHECK-NEXT: [7] - JLAGU
+# CHECK-NEXT: [8] - JMul
+# CHECK-NEXT: [9] - JSAGU
+# CHECK-NEXT: [10] - JSTC
+# CHECK-NEXT: [11] - JVALU0
+# CHECK-NEXT: [12] - JVALU1
+# CHECK-NEXT: [13] - JVIMUL
+
+# CHECK: Resource pressure per iteration:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
+# CHECK-NEXT: - 1.00 - - - 2.00 3.00 - - - - 2.00 3.00 -
+
+# CHECK: Resource pressure by instruction:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Instructions:
+# CHECK-NEXT: - 1.00 - - - - - - - - - - - - addl %ebx, %ebx
+# CHECK-NEXT: - - - - - - 1.00 - - - - - 1.00 - vpinsrd $1, %ebx, %xmm0, %xmm1
+# CHECK-NEXT: - - - - - 1.00 - - - - - 1.00 - - vpinsrd $1, %ebx, %xmm2, %xmm3
+# CHECK-NEXT: - - - - - - 1.00 - - - - - 1.00 - vpinsrd $2, %ebx, %xmm4, %xmm5
+# CHECK-NEXT: - - - - - 1.00 - - - - - 1.00 - - vpinsrd $2, %ebx, %xmm6, %xmm7
+# CHECK-NEXT: - - - - - - 1.00 - - - - - 1.00 - vpinsrd $3, %ebx, %xmm8, %xmm10
+
+# CHECK: Timeline view:
+# CHECK-NEXT: 012
+# CHECK-NEXT: Index 0123456789
+
+# CHECK: [0,0] DeER . . . addl %ebx, %ebx
+# CHECK-NEXT: [0,1] .D======eER . vpinsrd $1, %ebx, %xmm0, %xmm1
+# CHECK-NEXT: [0,2] . D=====eER . vpinsrd $1, %ebx, %xmm2, %xmm3
+# CHECK-NEXT: [0,3] . D=====eER. vpinsrd $2, %ebx, %xmm4, %xmm5
+# CHECK-NEXT: [0,4] . D====eER. vpinsrd $2, %ebx, %xmm6, %xmm7
+# CHECK-NEXT: [0,5] . D====eER vpinsrd $3, %ebx, %xmm8, %xmm10
+
+# CHECK: Average Wait times (based on the timeline view):
+# CHECK-NEXT: [0]: Executions
+# CHECK-NEXT: [1]: Average time spent waiting in a scheduler's queue
+# CHECK-NEXT: [2]: Average time spent waiting in a scheduler's queue while ready
+# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
+
+# CHECK: [0] [1] [2] [3]
+# CHECK-NEXT: 0. 1 1.0 1.0 0.0 addl %ebx, %ebx
+# CHECK-NEXT: 1. 1 7.0 0.0 0.0 vpinsrd $1, %ebx, %xmm0, %xmm1
+# CHECK-NEXT: 2. 1 6.0 0.0 0.0 vpinsrd $1, %ebx, %xmm2, %xmm3
+# CHECK-NEXT: 3. 1 6.0 1.0 0.0 vpinsrd $2, %ebx, %xmm4, %xmm5
+# CHECK-NEXT: 4. 1 5.0 1.0 0.0 vpinsrd $2, %ebx, %xmm6, %xmm7
+# CHECK-NEXT: 5. 1 5.0 2.0 0.0 vpinsrd $3, %ebx, %xmm8, %xmm10
+# CHECK-NEXT: 1 5.0 0.8 0.0 <total>
diff --git a/llvm/test/tools/llvm-ml/hexfloat_error.asm b/llvm/test/tools/llvm-ml/hexfloat_error.asm
new file mode 100644
index 000000000000..d917529540d5
--- /dev/null
+++ b/llvm/test/tools/llvm-ml/hexfloat_error.asm
@@ -0,0 +1,10 @@
+; RUN: not llvm-ml -filetype=s %s /WX /Fo /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+
+.data
+
+; CHECK: :[[# @LINE + 1]]:25: error: MASM-style hex floats ignore explicit sign
+negative_hexfloat REAL4 -3fa66666r
+
+.code
+
+END
diff --git a/llvm/test/tools/llvm-ml/hexfloat_warn.asm b/llvm/test/tools/llvm-ml/hexfloat_warn.asm
new file mode 100644
index 000000000000..5ba3083af7da
--- /dev/null
+++ b/llvm/test/tools/llvm-ml/hexfloat_warn.asm
@@ -0,0 +1,12 @@
+; RUN: llvm-ml -filetype=s %s /Fo - 2>&1 | FileCheck %s
+
+.data
+
+; CHECK: :[[# @LINE + 1]]:25: warning: MASM-style hex floats ignore explicit sign
+negative_hexfloat REAL4 -3fa66666r
+; CHECK-LABEL: negative_hexfloat:
+; CHECK-NEXT: .long 1067869798
+
+.code
+
+END
diff --git a/llvm/test/tools/llvm-ml/variable.asm b/llvm/test/tools/llvm-ml/variable.asm
index b31879fc28aa..268a03d608fd 100644
--- a/llvm/test/tools/llvm-ml/variable.asm
+++ b/llvm/test/tools/llvm-ml/variable.asm
@@ -3,11 +3,21 @@
.data
t1_value equ 1 or 2
-t1 BYTE t1_value DUP (0)
-; CHECK: t1:
+t1 BYTE t1_VALUE DUP (0)
+; CHECK-LABEL: t1:
; CHECK-NEXT: .byte 0
; CHECK-NEXT: .byte 0
; CHECK-NEXT: .byte 0
; CHECK-NOT: .byte 0
+t2_value equ 4 or t1_value
+t2 BYTE t2_VALUE
+; CHECK-LABEL: t2:
+; CHECK-NEXT: .byte 7
+
+t3_value equ t1_VALUE or 8
+t3 BYTE t3_VALUE
+; CHECK-LABEL: t3:
+; CHECK-NEXT: .byte 11
+
END
diff --git a/llvm/test/tools/llvm-nm/ARM/special-syms.test b/llvm/test/tools/llvm-nm/ARM/special-syms.test
new file mode 100644
index 000000000000..534be1773c5b
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/ARM/special-syms.test
@@ -0,0 +1,30 @@
+## Test --special-syms flag for ARM mapping symbols used to mark transitions
+## between ARM code, THUMB code and data ($a, $t, $t).
+#
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-nm %t | count 0
+# RUN: llvm-nm --special-syms %t | FileCheck %s
+
+!ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_ARM
+ Flags: [ EF_ARM_EABI_VER5 ]
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x4
+Symbols:
+ - Name: '$d.0'
+ Section: .text
+ - Name: '$a.1'
+ Section: .text
+ - Name: '$t.1'
+ Section: .text
+
+# CHECK: 00000000 t $a.1
+# CHECK: 00000000 t $d.0
+# CHECK: 00000000 t $t.1
diff --git a/llvm/test/tools/llvm-nm/debug-syms.test b/llvm/test/tools/llvm-nm/debug-syms.test
index 0f970916499f..e58176588d30 100644
--- a/llvm/test/tools/llvm-nm/debug-syms.test
+++ b/llvm/test/tools/llvm-nm/debug-syms.test
@@ -1,6 +1,6 @@
# RUN: yaml2obj %s -o %t.o
-# RUN: llvm-nm --special-syms --debug-syms %t.o | FileCheck %s --implicit-check-not {{.}} --check-prefix SYMBOL
-# RUN: llvm-nm --special-syms -a %t.o | FileCheck %s --implicit-check-not {{.}} --check-prefix SYMBOL
+# RUN: llvm-nm --debug-syms %t.o | FileCheck %s --implicit-check-not {{.}} --check-prefix SYMBOL
+# RUN: llvm-nm -a %t.o | FileCheck %s --implicit-check-not {{.}} --check-prefix SYMBOL
# SYMBOL: 0000000000000000 n $a
# SYMBOL-NEXT: 0000000000000000 n $d
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
index ff0a2920c4f6..98b8b9a4f0b6 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
@@ -19,11 +19,12 @@
my_kernel.kd:
.long 0x00000000 ;; group_segment_fixed_size
.long 0x00000000 ;; private_segment_fixed_size
- .quad 0x00FF000000000000 ;; reserved bytes.
+ .long 0x00000000 ;; kernarg_segment_size.
+ .long 0x00000000 ;; reserved bytes.
.quad 0x0000000000000000 ;; kernel_code_entry_byte_offset, any value works.
;; 20 reserved bytes.
- .quad 0x0000000000000000
+ .quad 0x00FF000000000000 ;; reserved bytes.
.quad 0x0000000000000000
.long 0x00000000
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
index 76ccc904b883..e397932585bb 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
@@ -2,19 +2,19 @@
; RUN: split-file %s %t.dir
-; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1
+; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1-re-assemble
; RUN: diff %t1 %t1-re-assemble
-; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2
+; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2-re-assemble
; RUN: diff %t2 %t2-re-assemble
-; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t3
+; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3
; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t3-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3-re-assemble
; RUN: diff %t3 %t3-re-assemble
@@ -34,7 +34,7 @@
.amdhsa_next_free_vgpr 0
.amdhsa_next_free_sgpr 0
.amdhsa_reserve_flat_scratch 1
- .amdhsa_reserve_xnack_mask 1
+ .amdhsa_reserve_xnack_mask 0
.amdhsa_reserve_vcc 1
.end_amdhsa_kernel
@@ -44,6 +44,6 @@
.amdhsa_next_free_vgpr 0
.amdhsa_next_free_sgpr 35
.amdhsa_reserve_flat_scratch 1
- .amdhsa_reserve_xnack_mask 1
+ .amdhsa_reserve_xnack_mask 0
.amdhsa_reserve_vcc 1
.end_amdhsa_kernel
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
index 2176f5852dc1..ba6e1d60b207 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
@@ -2,19 +2,19 @@
; RUN: split-file %s %t.dir
-; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1
+; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1-re-assemble
; RUN: diff %t1 %t1-re-assemble
-; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2
+; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2-re-assemble
; RUN: diff %t2 %t2-re-assemble
-; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t3
+; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3
; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +8 \
-; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t3-re-assemble
+; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3-re-assemble
; RUN: diff %t3 %t3-re-assemble
;--- 1.s
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s
index 24e316877d38..761e0162c6b5 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s
@@ -1,6 +1,6 @@
;; Entirely zeroed kernel descriptor (for GFX10).
-; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=obj -o %t
+; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=-xnack -filetype=obj -o %t
; RUN: llvm-objdump -s -j .text %t | FileCheck --check-prefix=OBJDUMP %s
;; TODO:
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
index 55a4e36a233d..68a502492c50 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
@@ -1,8 +1,8 @@
;; Entirely zeroed kernel descriptor (for GFX9).
-; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1
+; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel.kd %t1 \
-; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2
+; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN: diff %t1 %t2
; RUN: llvm-objdump -s -j .text %t1 | FileCheck --check-prefix=OBJDUMP %s
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
index 05b017975fff..7e98bd9f67c0 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
@@ -1,6 +1,6 @@
-; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t1
+; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel.kd %t1 \
-; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t2
+; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN: llvm-objdump -s -j .text %t2 | FileCheck --check-prefix=OBJDUMP %s
;; Not running lit-test over gfx10 (see kd-zeroed-gfx10.s for details).
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/subtarget.ll b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/subtarget.ll
index 52c6ccac07ed..f9575c40492b 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/subtarget.ll
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/subtarget.ll
@@ -44,6 +44,16 @@ define amdgpu_kernel void @test_kernel() {
; ----------------------------------GFX9---------------------------------------
;
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90c -filetype=obj -O0 -o %t.o %s
+; RUN: llvm-objdump -D --arch-name=amdgcn --mcpu=gfx90c %t.o > %t-specify.txt
+; RUN: llvm-objdump -D %t.o > %t-detect.txt
+; RUN: diff %t-specify.txt %t-detect.txt
+
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -filetype=obj -O0 -o %t.o %s
+; RUN: llvm-objdump -D --arch-name=amdgcn --mcpu=gfx90a %t.o > %t-specify.txt
+; RUN: llvm-objdump -D %t.o > %t-detect.txt
+; RUN: diff %t-specify.txt %t-detect.txt
+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx909 -filetype=obj -O0 -o %t.o %s
; RUN: llvm-objdump -D --arch-name=amdgcn --mcpu=gfx909 %t.o > %t-specify.txt
; RUN: llvm-objdump -D %t.o > %t-detect.txt
diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
index f82d403437b4..c2fc95ed4f02 100644
--- a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
+++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
@@ -12,8 +12,8 @@
; RUN: sed -e "s,SRC_COMPDIR,./Inputs,g" %p/Inputs/source-interleave.ll > %t-relative-path.ll
; RUN: llc -o %t-relative-path.o -filetype=obj -mtriple=x86_64-pc-linux %t-relative-path.ll
; RUN: llvm-objdump --prefix myprefix --source %t-relative-path.o 2>&1 | \
-; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-relative-path.o -DPREFIX=.
-; CHECK-BROKEN-PREFIX: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs{{[/\\]}}source-interleave-x86_64.c
+; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-relative-path.o -DPREFIX=. -DCOMPDIR=/Inputs
+; CHECK-BROKEN-PREFIX: warning: '[[FILE]]': failed to find source [[PREFIX]][[COMPDIR]]{{[/\\]}}source-interleave-x86_64.c
;; Test invalid source interleave fixed by adding the correct prefix.
@@ -28,16 +28,64 @@
; RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t-correct-prefix.ll
; RUN: llc -o %t-correct-prefix.o -filetype=obj -mtriple=x86_64-pc-linux %t-correct-prefix.ll
; RUN: llvm-objdump --prefix myprefix --source %t-correct-prefix.o 2>&1 | \
-; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-correct-prefix.o -DPREFIX=myprefix%/p
+; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-correct-prefix.o -DPREFIX=myprefix%/p -DCOMPDIR=/Inputs
;; Using only a prefix separator is the same as not using the `--prefix` option.
; RUN: llvm-objdump --prefix / --source %t-missing-prefix.o 2>&1 | \
-; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-missing-prefix.o -DPREFIX=''
+; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-missing-prefix.o -DPREFIX='' -DCOMPDIR=/Inputs
;; All trailing separators on the prefix are discarded.
;; The prefix 'myprefix//' is converted to 'myprefix'.
; RUN: llvm-objdump --prefix myprefix// --source %t-missing-prefix.o 2>&1 | \
-; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-missing-prefix.o -DPREFIX=myprefix
+; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-missing-prefix.o -DPREFIX=myprefix -DCOMPDIR=/Inputs
+;; Test invalid source interleave fixed by adding the correct prefix and
+;; stripping out an extra directory from the path.
+
+; RUN: sed -e "s,SRC_COMPDIR,/extra/Inputs,g" %p/Inputs/source-interleave.ll > %t-extra-path-prefix.ll
+; RUN: llc -o %t-extra-path-prefix.o -filetype=obj -mtriple=x86_64-pc-linux %t-extra-path-prefix.ll
+; RUN: llvm-objdump --prefix %p --prefix-strip 1 --source %t-extra-path-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
+
+;; Test do not skip extra separators. The --prefix-strip should take into
+;; account each separator individually. Hence, to fix '/extra/Inputs'
+;; --prefix-strip needs to be 1. To fix '//extra/Inputs' --prefix-strip
+;; needs to be 2.
+
+; RUN: sed -e "s,SRC_COMPDIR,//extra/Inputs,g" %p/Inputs/source-interleave.ll > %t-extra-sep-path-prefix.ll
+; RUN: llc -o %t-extra-sep-path-prefix.o -filetype=obj -mtriple=x86_64-pc-linux %t-extra-sep-path-prefix.ll
+; RUN: llvm-objdump --prefix %p --prefix-strip 2 --source %t-extra-sep-path-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
+
+;; Test --prefix-strip value of 0. No effect.
+;; SRC_COMPDIR is set to '/Inputs' before and after --prefix-strip 0.
+
+; RUN: llvm-objdump --prefix %p --prefix-strip 0 --source %t-missing-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
+
+;; Test --prefix-strip value equal to the number of directory components.
+;; SRC_COMPDIR is set to '/Inputs' before --prefix-strip 1.
+;; SRC_COMPDIR becomes '' after --prefix-strip 1.
+
+; RUN: llvm-objdump --prefix %p/Inputs --prefix-strip 1 --source %t-missing-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
+
+;; Test --prefix-strip value greater than the number of components.
+;; SRC_COMPDIR is set to '/Inputs' before --prefix-strip 2.
+;; SRC_COMPDIR becomes '' after --prefix-strip 2.
+
+; RUN: llvm-objdump --prefix %p/Inputs --prefix-strip 2 --source %t-missing-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
+
+;; Test negative value --prefix-strip. Reports an error.
+
+; RUN: not llvm-objdump --prefix %p --prefix-strip '-1' --source %t-missing-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-INVALID-PREFIX-STRIP -DOPTION='-1'
+; CHECK-INVALID-PREFIX-STRIP: llvm-objdump{{.*}}: for the --prefix-strip option: '[[OPTION]]' value invalid for uint argument!
+
+;; Test text value --prefix-strip. Reports an error.
+
+; RUN: not llvm-objdump --prefix %p --prefix-strip foo --source %t-missing-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-INVALID-PREFIX-STRIP -DOPTION='foo'
diff --git a/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test b/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
index 32ec800f8caf..a55382105a73 100644
--- a/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
+++ b/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
@@ -39,7 +39,7 @@ CHECK-NEXT: Address is at offset 12/202 of Stream 1 (PDB Stream).
CHECK-NEXT: Within the PDB stream:
CHECK-NEXT: address is at offset 12/28 of the PDB Stream Header.
CHECK-NEXT: which contains the guid of the PDB.
-CHECK-NEXT: The current value is {826BE46E-02ED-7043-9C27-20CCC07E92A7}.
+CHECK-NEXT: The current value is {6EE46B82-ED02-4370-9C27-20CCC07E92A7}.
CHECK: Block:Offset = 11:001C.
CHECK-NEXT: Address is in block 17 (allocated).
diff --git a/llvm/test/tools/llvm-pdbutil/stripped.test b/llvm/test/tools/llvm-pdbutil/stripped.test
index 1d12c9ecfa2d..d321a098d19d 100644
--- a/llvm/test/tools/llvm-pdbutil/stripped.test
+++ b/llvm/test/tools/llvm-pdbutil/stripped.test
@@ -8,7 +8,7 @@
; CHECK-NEXT: Number of streams: 12
; CHECK-NEXT: Signature: 1541179274
; CHECK-NEXT: Age: 2
-; CHECK-NEXT: GUID: {FF4F9B62-D99A-4647-97A7-22C702B1E053}
+; CHECK-NEXT: GUID: {629B4FFF-9AD9-4746-97A7-22C702B1E053}
; CHECK-NEXT: Features: 0x1
; CHECK-NEXT: Has Debug Info: true
; CHECK-NEXT: Has Types: true
diff --git a/llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext b/llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext
new file mode 100644
index 000000000000..34aa03640176
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext
@@ -0,0 +1,6 @@
+:fe
+foo
+29667547796
+2
+100
+90
diff --git a/llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext b/llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext
new file mode 100644
index 000000000000..b177a624a7b5
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext
@@ -0,0 +1,6 @@
+:ir
+foo2
+29667547796
+2
+100
+90
diff --git a/llvm/test/tools/llvm-profdata/merge-incompatible.test b/llvm/test/tools/llvm-profdata/merge-incompatible.test
new file mode 100644
index 000000000000..dad1c0ad5dbb
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/merge-incompatible.test
@@ -0,0 +1,2 @@
+RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext -o /dev/null 2>&1 | FileCheck %s
+CHECK: ir-basic.proftext: Merge IR generated profile with Clang generated profile.
diff --git a/llvm/test/tools/llvm-profgen/cs-preinline.test b/llvm/test/tools/llvm-profgen/cs-preinline.test
new file mode 100644
index 000000000000..e9aa7cbc73aa
--- /dev/null
+++ b/llvm/test/tools/llvm-profgen/cs-preinline.test
@@ -0,0 +1,41 @@
+; Test default llvm-profgen with preinline off
+; RUN: llvm-profgen --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t
+; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-DEFAULT
+
+; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
+; RUN: llvm-profgen --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1
+; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-PREINL
+
+; Test preinliner threshold that prevents all possible inlining and merges everything into base profile.
+; RUN: llvm-profgen --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1 -sample-profile-hot-inline-threshold=0
+; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-NO-PREINL
+
+; CHECK-DEFAULT: [main:1 @ foo]:309:0
+; CHECK-DEFAULT-NEXT: 2.1: 14
+; CHECK-DEFAULT-NEXT: 3: 15
+; CHECK-DEFAULT-NEXT: 3.1: 14 bar:14
+; CHECK-DEFAULT-NEXT: 3.2: 1
+; CHECK-DEFAULT-NEXT: !Attributes: 1
+; CHECK-DEFAULT-NEXT:[main:1 @ foo:3.1 @ bar]:84:0
+; CHECK-DEFAULT-NEXT: 1: 14
+; CHECK-DEFAULT-NEXT: !Attributes: 1
+
+; CHECK-PREINL: [foo]:309:0
+; CHECK-PREINL-NEXT: 2.1: 14
+; CHECK-PREINL-NEXT: 3: 15
+; CHECK-PREINL-NEXT: 3.1: 14 bar:14
+; CHECK-PREINL-NEXT: 3.2: 1
+; CHECK-PREINL-NEXT: !Attributes: 1
+; CHECK-PREINL-NEXT:[foo:3.1 @ bar]:84:0
+; CHECK-PREINL-NEXT: 1: 14
+; CHECK-PREINL-NEXT: !Attributes: 3
+
+; CHECK-NO-PREINL: [foo]:309:0
+; CHECK-NO-PREINL-NEXT: 2.1: 14
+; CHECK-NO-PREINL-NEXT: 3: 15
+; CHECK-NO-PREINL-NEXT: 3.1: 14 bar:14
+; CHECK-NO-PREINL-NEXT: 3.2: 1
+; CHECK-NO-PREINL-NEXT: !Attributes: 1
+; CHECK-NO-PREINL-NEXT:[bar]:84:0
+; CHECK-NO-PREINL-NEXT: 1: 14
+; CHECK-NO-PREINL-NEXT: !Attributes: 1
diff --git a/llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test b/llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test
index 15bdd870879e..f002a09532e3 100644
--- a/llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test
+++ b/llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test
@@ -10,16 +10,16 @@
; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa]:24:0
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 2: 13 fb:11
-; CHECK-UNCOMPRESS:[main:1 @ foo]:7:0
-; CHECK-UNCOMPRESS: 2: 1
-; CHECK-UNCOMPRESS: 3: 2 fa:1
; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa]:7:0
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 2: 2 fb:1
-; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb]:2:0
-; CHECK-UNCOMPRESS: 2: 1 fa:1
+; CHECK-UNCOMPRESS:[main:1 @ foo]:7:0
+; CHECK-UNCOMPRESS: 2: 1
+; CHECK-UNCOMPRESS: 3: 2 fa:1
; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb:2 @ fa]:2:0
; CHECK-UNCOMPRESS: 4: 1
+; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb]:2:0
+; CHECK-UNCOMPRESS: 2: 1 fa:1
; CHECK: [main:1 @ foo:3 @ fa:2 @ fb]:48:0
diff --git a/llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test b/llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
index 0936e5d615ca..3345721722f8 100644
--- a/llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
+++ b/llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
@@ -4,11 +4,11 @@
; RUN: llvm-profgen --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --show-unwinder-output --csprof-cold-thres=0 | FileCheck %s --check-prefix=CHECK-UNWINDER
; RUN: FileCheck %s --input-file %t
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa]:4:1
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:4:1
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 3: 1
-; CHECK-UNCOMPRESS: 5: 1
-; CHECK-UNCOMPRESS: 8: 1 fa:1
+; CHECK-UNCOMPRESS: 4: 1
+; CHECK-UNCOMPRESS: 7: 1 fb:1
; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909
; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa]:4:1
; CHECK-UNCOMPRESS: 1: 1
@@ -16,28 +16,13 @@
; CHECK-UNCOMPRESS: 4: 1
; CHECK-UNCOMPRESS: 7: 1 fb:1
; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:4:1
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa]:4:1
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 3: 1
-; CHECK-UNCOMPRESS: 4: 1
-; CHECK-UNCOMPRESS: 7: 1 fb:1
+; CHECK-UNCOMPRESS: 5: 1
+; CHECK-UNCOMPRESS: 8: 1 fa:1
; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
-; CHECK-UNCOMPRESS: 1: 1
-; CHECK-UNCOMPRESS: 2: 1
-; CHECK-UNCOMPRESS: 5: 1 fb:1
-; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
-; CHECK-UNCOMPRESS: 1: 1
-; CHECK-UNCOMPRESS: 2: 1
-; CHECK-UNCOMPRESS: 5: 1 fb:1
-; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
-; CHECK-UNCOMPRESS: 1: 1
-; CHECK-UNCOMPRESS: 2: 1
-; CHECK-UNCOMPRESS: 5: 1 fb:1
-; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 3: 1
; CHECK-UNCOMPRESS: 6: 1 fa:1
@@ -47,11 +32,26 @@
; CHECK-UNCOMPRESS: 3: 1
; CHECK-UNCOMPRESS: 6: 1 fa:1
; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
-; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 3: 1
; CHECK-UNCOMPRESS: 6: 1 fa:1
; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
+; CHECK-UNCOMPRESS: 1: 1
+; CHECK-UNCOMPRESS: 2: 1
+; CHECK-UNCOMPRESS: 5: 1 fb:1
+; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
+; CHECK-UNCOMPRESS: 1: 1
+; CHECK-UNCOMPRESS: 2: 1
+; CHECK-UNCOMPRESS: 5: 1 fb:1
+; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
+; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
+; CHECK-UNCOMPRESS: 1: 1
+; CHECK-UNCOMPRESS: 2: 1
+; CHECK-UNCOMPRESS: 5: 1 fb:1
+; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756
; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb:6 @ fa]:2:1
; CHECK-UNCOMPRESS: 1: 1
; CHECK-UNCOMPRESS: 3: 1
@@ -74,24 +74,24 @@
; CHECK: 4: 1
; CHECK: 7: 1 fb:1
; CHECK: !CFGChecksum: 120515930909
-; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa]:4:1
-; CHECK: 1: 1
-; CHECK: 3: 1
-; CHECK: 5: 1
-; CHECK: 8: 1 fa:1
-; CHECK: !CFGChecksum: 120515930909
; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa]:4:1
; CHECK: 1: 1
; CHECK: 3: 1
; CHECK: 4: 1
; CHECK: 7: 1 fb:1
; CHECK: !CFGChecksum: 120515930909
-; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb]:3:1
+; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa]:4:1
+; CHECK: 1: 1
+; CHECK: 3: 1
+; CHECK: 5: 1
+; CHECK: 8: 1 fa:1
+; CHECK: !CFGChecksum: 120515930909
+; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
; CHECK: 1: 1
; CHECK: 3: 1
; CHECK: 6: 1 fa:1
; CHECK: !CFGChecksum: 72617220756
-; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
+; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb]:3:1
; CHECK: 1: 1
; CHECK: 3: 1
; CHECK: 6: 1 fa:1
@@ -99,6 +99,7 @@
+
; CHECK-UNWINDER: Binary(recursion-compression-pseudoprobe.perfbin)'s Range Counter:
; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5
; CHECK-UNWINDER: (7a0, 7a7): 1
diff --git a/llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-headers.test b/llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-headers.test
index 7a70933c340c..157ac6aa9d04 100644
--- a/llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-headers.test
+++ b/llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-headers.test
@@ -1,127 +1,338 @@
-# RUN: yaml2obj %s -o %t -DCPU=GFX600
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX600 -DFLAGS=0x20
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600 -DFLAG_VALUE=0x20
-# RUN: yaml2obj %s -o %t -DCPU=GFX601
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX601 -DFLAGS=0x21
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600 -DFLAG_VALUE=0x20
-# RUN: yaml2obj %s -o %t -DCPU=GFX602
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX602 -DFLAGS=0x3A
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX600 -DFLAG_VALUE=0x20
-# RUN: yaml2obj %s -o %t -DCPU=GFX700
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX700 -DFLAGS=0x22
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601 -DFLAG_VALUE=0x21
-# RUN: yaml2obj %s -o %t -DCPU=GFX701
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX701 -DFLAGS=0x23
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601 -DFLAG_VALUE=0x21
-# RUN: yaml2obj %s -o %t -DCPU=GFX702
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX702 -DFLAGS=0x24
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX601 -DFLAG_VALUE=0x21
-# RUN: yaml2obj %s -o %t -DCPU=GFX703
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX703 -DFLAGS=0x25
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602 -DFLAG_VALUE=0x3A
-# RUN: yaml2obj %s -o %t -DCPU=GFX704
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX704 -DFLAGS=0x26
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602 -DFLAG_VALUE=0x3A
-# RUN: yaml2obj %s -o %t -DCPU=GFX705
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX705 -DFLAGS=0x3B
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX602 -DFLAG_VALUE=0x3A
-# RUN: yaml2obj %s -o %t -DCPU=GFX801
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX801 -DFLAGS=0x28
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700 -DFLAG_VALUE=0x22
-# RUN: yaml2obj %s -o %t -DCPU=GFX802
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX802 -DFLAGS=0x29
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700 -DFLAG_VALUE=0x22
-# RUN: yaml2obj %s -o %t -DCPU=GFX803
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX803 -DFLAGS=0x2A
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX700 -DFLAG_VALUE=0x22
-# RUN: yaml2obj %s -o %t -DCPU=GFX805
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX805 -DFLAGS=0x3C
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701 -DFLAG_VALUE=0x23
-# RUN: yaml2obj %s -o %t -DCPU=GFX810
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX810 -DFLAGS=0x2B
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701 -DFLAG_VALUE=0x23
-# RUN: yaml2obj %s -o %t -DCPU=GFX900
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX900 -DFLAGS=0x2C
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX701 -DFLAG_VALUE=0x23
-# RUN: yaml2obj %s -o %t -DCPU=GFX902
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX902 -DFLAGS=0x2D
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702 -DFLAG_VALUE=0x24
-# RUN: yaml2obj %s -o %t -DCPU=GFX904
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX904 -DFLAGS=0x2E
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702 -DFLAG_VALUE=0x24
-# RUN: yaml2obj %s -o %t -DCPU=GFX906
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX906 -DFLAGS=0x2F
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX702 -DFLAG_VALUE=0x24
-# RUN: yaml2obj %s -o %t -DCPU=GFX908
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX908 -DFLAGS=0x30
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703 -DFLAG_VALUE=0x25
-# RUN: yaml2obj %s -o %t -DCPU=GFX909
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX909 -DFLAGS=0x31
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703 -DFLAG_VALUE=0x25
-# RUN: yaml2obj %s -o %t -DCPU=GFX90A
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX90A -DFLAGS=0x3F
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX703 -DFLAG_VALUE=0x25
-# RUN: yaml2obj %s -o %t -DCPU=GFX90C
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX90C -DFLAGS=0x32
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704 -DFLAG_VALUE=0x26
-# RUN: yaml2obj %s -o %t -DCPU=GFX1010
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1010 -DFLAGS=0x33
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704 -DFLAG_VALUE=0x26
-# RUN: yaml2obj %s -o %t -DCPU=GFX1011
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1011 -DFLAGS=0x34
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX704 -DFLAG_VALUE=0x26
-# RUN: yaml2obj %s -o %t -DCPU=GFX1012
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1012 -DFLAGS=0x35
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705 -DFLAG_VALUE=0x3B
-# RUN: yaml2obj %s -o %t -DCPU=GFX1030
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1030 -DFLAGS=0x36
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705 -DFLAG_VALUE=0x3B
-# RUN: yaml2obj %s -o %t -DCPU=GFX1031
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1031 -DFLAGS=0x37
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX705 -DFLAG_VALUE=0x3B
-# RUN: yaml2obj %s -o %t -DCPU=GFX1032
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1032 -DFLAGS=0x38
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801 -DFLAG_VALUE=0x28
-# RUN: yaml2obj %s -o %t -DCPU=GFX1033
-# RUN: llvm-readobj -h %t | FileCheck %s --match-full-lines -DFILE=%t -DCPU=GFX1033 -DFLAGS=0x39
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801 -DFLAG_VALUE=0x28
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX801 -DFLAG_VALUE=0x28
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802 -DFLAG_VALUE=0x29
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802 -DFLAG_VALUE=0x29
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX802 -DFLAG_VALUE=0x29
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803 -DFLAG_VALUE=0x2A
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803 -DFLAG_VALUE=0x2A
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX803 -DFLAG_VALUE=0x2A
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805 -DFLAG_VALUE=0x3C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805 -DFLAG_VALUE=0x3C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX805 -DFLAG_VALUE=0x3C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810 -DFLAG_VALUE=0x2B
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810 -DFLAG_VALUE=0x2B
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX810 -DFLAG_VALUE=0x2B
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900 -DFLAG_VALUE=0x2C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900 -DFLAG_VALUE=0x2C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX900 -DFLAG_VALUE=0x2C
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902 -DFLAG_VALUE=0x2D
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902 -DFLAG_VALUE=0x2D
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX902 -DFLAG_VALUE=0x2D
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904 -DFLAG_VALUE=0x2E
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904 -DFLAG_VALUE=0x2E
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX904 -DFLAG_VALUE=0x2E
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906 -DFLAG_VALUE=0x2F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906 -DFLAG_VALUE=0x2F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX906 -DFLAG_VALUE=0x2F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908 -DFLAG_VALUE=0x30
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908 -DFLAG_VALUE=0x30
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX908 -DFLAG_VALUE=0x30
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909 -DFLAG_VALUE=0x31
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909 -DFLAG_VALUE=0x31
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX909 -DFLAG_VALUE=0x31
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A -DFLAG_VALUE=0x3F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A -DFLAG_VALUE=0x3F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A -DFLAG_VALUE=0x3F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C -DFLAG_VALUE=0x32
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C -DFLAG_VALUE=0x32
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90C -DFLAG_VALUE=0x32
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010 -DFLAG_VALUE=0x33
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010 -DFLAG_VALUE=0x33
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1010 -DFLAG_VALUE=0x33
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011 -DFLAG_VALUE=0x34
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011 -DFLAG_VALUE=0x34
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1011 -DFLAG_VALUE=0x34
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012 -DFLAG_VALUE=0x35
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012 -DFLAG_VALUE=0x35
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1012 -DFLAG_VALUE=0x35
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030 -DFLAG_VALUE=0x36
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030 -DFLAG_VALUE=0x36
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1030 -DFLAG_VALUE=0x36
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031 -DFLAG_VALUE=0x37
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031 -DFLAG_VALUE=0x37
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1031 -DFLAG_VALUE=0x37
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032 -DFLAG_VALUE=0x38
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032 -DFLAG_VALUE=0x38
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1032 -DFLAG_VALUE=0x38
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033 -DFLAG_VALUE=0x39
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033 -DFLAG_VALUE=0x39
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,SINGLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX1033 -DFLAG_VALUE=0x39
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_XNACK_V3"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_XNACK_V3 (0x100)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x13F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_XNACK_V3"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_XNACK_V3 (0x100)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x13F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=0 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_SRAMECC_V3"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=0 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_SRAMECC_V3 (0x200)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x23F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=1 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_SRAMECC_V3"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=1 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_SRAMECC_V3 (0x200)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x23F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_XNACK_ANY_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_XNACK_ANY_V4 (0x100)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x13F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_XNACK_OFF_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_XNACK_OFF_V4 (0x200)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x23F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_XNACK_ON_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_XNACK_ON_V4 (0x300)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x33F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_SRAMECC_ANY_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_SRAMECC_ANY_V4 (0x400)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x43F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_SRAMECC_OFF_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 (0x800)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0x83F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=2 -DFLAG_NAME="EF_AMDGPU_MACH_AMDGCN_GFX90A, EF_AMDGPU_FEATURE_SRAMECC_ON_V4"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,KNOWN-ABI-VERSION,DOUBLE-FLAG --match-full-lines -DABI_VERSION=2 -DFILE=%t -DFLAG_0="EF_AMDGPU_FEATURE_SRAMECC_ON_V4 (0xC00)" -DFLAG_1="EF_AMDGPU_MACH_AMDGCN_GFX90A (0x3F)" -DFLAG_VALUE=0xC3F
+
+# RUN: yaml2obj %s -o %t -DABI_VERSION=16 -DFLAG_NAME=EF_AMDGPU_MACH_AMDGCN_GFX90A
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=ALL,UNKNOWN-ABI-VERSION --match-full-lines -DABI_VERSION=16 -DFILE=%t -DFLAG_VALUE=0x3F
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_AMDGPU_HSA
+ ABIVersion: [[ABI_VERSION]]
Type: ET_REL
Machine: EM_AMDGPU
- Flags: [ EF_AMDGPU_MACH_AMDGCN_[[CPU]] ]
-
-# CHECK: File: [[FILE]]
-# CHECK-NEXT: Format: elf64-amdgpu
-# CHECK-NEXT: Arch: amdgcn
-# CHECK-NEXT: AddressSize: 64bit
-# CHECK-NEXT: LoadName: <Not found>
-# CHECK-NEXT: ElfHeader {
-# CHECK-NEXT: Ident {
-# CHECK-NEXT: Magic: (7F 45 4C 46)
-# CHECK-NEXT: Class: 64-bit (0x2)
-# CHECK-NEXT: DataEncoding: LittleEndian (0x1)
-# CHECK-NEXT: FileVersion: 1
-# CHECK-NEXT: OS/ABI: AMDGPU_HSA (0x40)
-# CHECK-NEXT: ABIVersion: 0
-# CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
-# CHECK-NEXT: }
-# CHECK-NEXT: Type: Relocatable (0x1)
-# CHECK-NEXT: Machine: EM_AMDGPU (0xE0)
-# CHECK-NEXT: Version: 1
-# CHECK-NEXT: Entry: 0x0
-# CHECK-NEXT: ProgramHeaderOffset: 0x0
-# CHECK-NEXT: SectionHeaderOffset: 0x58
-# CHECK-NEXT: Flags [ ([[FLAGS]])
-# CHECK-NEXT: EF_AMDGPU_MACH_AMDGCN_[[CPU]] ([[FLAGS]])
-# CHECK-NEXT: ]
-# CHECK-NEXT: HeaderSize: 64
-# CHECK-NEXT: ProgramHeaderEntrySize: 0
-# CHECK-NEXT: ProgramHeaderCount: 0
-# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 3
-# CHECK-NEXT: StringTableSectionIndex: 2
-# CHECK-NEXT: }
+ Flags: [ [[FLAG_NAME]] ]
+
+# ALL: File: [[FILE]]
+# ALL-NEXT: Format: elf64-amdgpu
+# ALL-NEXT: Arch: amdgcn
+# ALL-NEXT: AddressSize: 64bit
+# ALL-NEXT: LoadName: <Not found>
+# ALL-NEXT: ElfHeader {
+# ALL-NEXT: Ident {
+# ALL-NEXT: Magic: (7F 45 4C 46)
+# ALL-NEXT: Class: 64-bit (0x2)
+# ALL-NEXT: DataEncoding: LittleEndian (0x1)
+# ALL-NEXT: FileVersion: 1
+# ALL-NEXT: OS/ABI: AMDGPU_HSA (0x40)
+# ALL-NEXT: ABIVersion: [[ABI_VERSION]]
+# ALL-NEXT: Unused: (00 00 00 00 00 00 00)
+# ALL-NEXT: }
+# ALL-NEXT: Type: Relocatable (0x1)
+# ALL-NEXT: Machine: EM_AMDGPU (0xE0)
+# ALL-NEXT: Version: 1
+# ALL-NEXT: Entry: 0x0
+# ALL-NEXT: ProgramHeaderOffset: 0x0
+# ALL-NEXT: SectionHeaderOffset: 0x58
+# KNOWN-ABI-VERSION-NEXT: Flags [ ([[FLAG_VALUE]])
+# SINGLE-FLAG-NEXT: [[FLAG_NAME]] ([[FLAG_VALUE]])
+# DOUBLE-FLAG-NEXT: [[FLAG_0]]
+# DOUBLE-FLAG-NEXT: [[FLAG_1]]
+# KNOWN-ABI-VERSION-NEXT: ]
+# UNKNOWN-ABI-VERSION-NEXT: Flags: [[FLAG_VALUE]]
+# ALL-NEXT: HeaderSize: 64
+# ALL-NEXT: ProgramHeaderEntrySize: 0
+# ALL-NEXT: ProgramHeaderCount: 0
+# ALL-NEXT: SectionHeaderEntrySize: 64
+# ALL-NEXT: SectionHeaderCount: 3
+# ALL-NEXT: StringTableSectionIndex: 2
+# ALL-NEXT: }
diff --git a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
index f9b9dc0980e5..0cebfee6872a 100644
--- a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
+++ b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
@@ -24,6 +24,7 @@
# LLVM-NEXT: HasReturn: No
# LLVM-NEXT: HasTailCall: Yes
# LLVM-NEXT: IsEHPad: No
+# LLVM-NEXT: CanFallThrough: No
# LLVM-NEXT: }
# LLVM-NEXT: {
# LLVM-NEXT: Offset: 0x3
@@ -31,6 +32,7 @@
# LLVM-NEXT: HasReturn: Yes
# LLVM-NEXT: HasTailCall: No
# LLVM-NEXT: IsEHPad: Yes
+# LLVM-NEXT: CanFallThrough: No
# LLVM-NEXT: }
# LLVM-NEXT: ]
# LLVM-NEXT: }
@@ -43,6 +45,7 @@
# LLVM-NEXT: HasReturn: No
# LLVM-NEXT: HasTailCall: No
# LLVM-NEXT: IsEHPad: No
+# LLVM-NEXT: CanFallThrough: Yes
# LLVM-NEXT: }
# LLVM-NEXT: ]
# LLVM-NEXT: }
@@ -57,6 +60,7 @@
# LLVM-NEXT: HasReturn: Yes
# LLVM-NEXT: HasTailCall: Yes
# LLVM-NEXT: IsEHPad: No
+# LLVM-NEXT: CanFallThrough: Yes
# LLVM-NEXT: }
# LLVM-NEXT: ]
# LLVM-NEXT: }
@@ -78,6 +82,7 @@
# TRUNCATED-NEXT: HasReturn: Yes
# TRUNCATED-NEXT: HasTailCall: Yes
# TRUNCATED-NEXT: IsEHPad: No
+# TRUNCATED-NEXT: CanFallThrough: Yes
# TRUNCATED-NEXT: }
# TRUNCATED-NEXT: ]
# TRUNCATED-NEXT: }
diff --git a/llvm/test/tools/llvm-readobj/ELF/note-amd.s b/llvm/test/tools/llvm-readobj/ELF/note-amd.s
index c54ebd7aa32c..260be3a725af 100644
--- a/llvm/test/tools/llvm-readobj/ELF/note-amd.s
+++ b/llvm/test/tools/llvm-readobj/ELF/note-amd.s
@@ -6,25 +6,27 @@
// GNU: Displaying notes found in: .note.no.desc
// GNU-NEXT: Owner Data size Description
-// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
-// GNU-NEXT: HSA Metadata:
+// GNU-NEXT: AMD 0x00000000 NT_AMD_HSA_METADATA (AMD HSA Metadata)
+// GNU-NEXT: AMD HSA Metadata:
// GNU-NEXT: {{^ $}}
-// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_ISA (ISA Version)
-// GNU-NEXT: ISA Version:
+// GNU-NEXT: AMD 0x00000000 NT_AMD_HSA_ISA_NAME (AMD HSA ISA Name)
+// GNU-NEXT: AMD HSA ISA Name:
// GNU-NEXT: {{^ $}}
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.desc
// GNU-NEXT: Owner Data size Description
-// GNU-NEXT: AMD 0x0000000a NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
-// GNU-NEXT: HSA Metadata:
+// GNU-NEXT: AMD 0x0000000a NT_AMD_HSA_METADATA (AMD HSA Metadata)
+// GNU-NEXT: AMD HSA Metadata:
// GNU-NEXT: meta_blah
-// GNU-NEXT: AMD 0x00000009 NT_AMD_AMDGPU_ISA (ISA Version)
-// GNU-NEXT: ISA Version:
+// GNU-NEXT: AMD 0x00000009 NT_AMD_HSA_ISA_NAME (AMD HSA ISA Name)
+// GNU-NEXT: AMD HSA ISA Name:
// GNU-NEXT: isa_blah
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.other
// GNU-NEXT: Owner Data size Description
-// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
+// GNU-NEXT: AMD 0x00000000 NT_AMD_PAL_METADATA (AMD PAL Metadata)
+// GNU-NEXT: AMD PAL Metadata:
+// GNU-NEXT: {{^ $}}
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.unknown
// GNU-NEXT: Owner Data size Description
@@ -40,14 +42,14 @@
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: AMD
// LLVM-NEXT: Data size: 0x0
-// LLVM-NEXT: Type: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
-// LLVM-NEXT: HSA Metadata:
+// LLVM-NEXT: Type: NT_AMD_HSA_METADATA (AMD HSA Metadata)
+// LLVM-NEXT: AMD HSA Metadata:
// LLVM-NEXT: }
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: AMD
// LLVM-NEXT: Data size: 0x0
-// LLVM-NEXT: Type: NT_AMD_AMDGPU_ISA (ISA Version)
-// LLVM-NEXT: ISA Version:
+// LLVM-NEXT: Type: NT_AMD_HSA_ISA_NAME (AMD HSA ISA Name)
+// LLVM-NEXT: AMD HSA ISA Name:
// LLVM-NEXT: }
// LLVM-NEXT: }
// LLVM-NEXT: NoteSection {
@@ -57,14 +59,14 @@
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: AMD
// LLVM-NEXT: Data size: 0xA
-// LLVM-NEXT: Type: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
-// LLVM-NEXT: HSA Metadata: meta_blah
+// LLVM-NEXT: Type: NT_AMD_HSA_METADATA (AMD HSA Metadata)
+// LLVM-NEXT: AMD HSA Metadata: meta_blah
// LLVM-NEXT: }
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: AMD
// LLVM-NEXT: Data size: 0x9
-// LLVM-NEXT: Type: NT_AMD_AMDGPU_ISA (ISA Version)
-// LLVM-NEXT: ISA Version: isa_blah
+// LLVM-NEXT: Type: NT_AMD_HSA_ISA_NAME (AMD HSA ISA Name)
+// LLVM-NEXT: AMD HSA ISA Name: isa_blah
// LLVM-NEXT: }
// LLVM-NEXT: }
// LLVM-NEXT: NoteSection {
@@ -74,7 +76,8 @@
// LLVM-NEXT: Note {
// LLVM-NEXT: Owner: AMD
// LLVM-NEXT: Data size: 0x0
-// LLVM-NEXT: Type: NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
+// LLVM-NEXT: Type: NT_AMD_PAL_METADATA (AMD PAL Metadata)
+// LLVM-NEXT: AMD PAL Metadata:
// LLVM-NEXT: }
// LLVM-NEXT: }
// LLVM-NEXT: NoteSection {
@@ -96,17 +99,17 @@
.align 4
.long 4 /* namesz */
.long 0 /* descsz */
- .long 10 /* type = NT_AMD_AMDGPU_HSA_METADATA */
+ .long 10 /* type = NT_AMD_HSA_METADATA */
.asciz "AMD"
.long 4 /* namesz */
.long 0 /* descsz */
- .long 11 /* type = NT_AMD_AMDGPU_ISA */
+ .long 11 /* type = NT_AMD_HSA_ISA_NAME */
.asciz "AMD"
.section ".note.desc", "a"
.align 4
.long 4 /* namesz */
.long end.meta - begin.meta /* descsz */
- .long 10 /* type = NT_AMD_AMDGPU_HSA_METADATA */
+ .long 10 /* type = NT_AMD_HSA_METADATA */
.asciz "AMD"
begin.meta:
.asciz "meta_blah"
@@ -114,7 +117,7 @@ end.meta:
.align 4
.long 4 /* namesz */
.long end.isa - begin.isa /* descsz */
- .long 11 /* type = NT_AMD_AMDGPU_ISA */
+ .long 11 /* type = NT_AMD_HSA_ISA_NAME */
.asciz "AMD"
begin.isa:
.asciz "isa_blah"
@@ -124,7 +127,7 @@ end.isa:
.align 4
.long 4 /* namesz */
.long 0 /* descsz */
- .long 12 /* type = NT_AMD_AMDGPU_PAL_METADATA */
+ .long 12 /* type = NT_AMD_PAL_METADATA */
.asciz "AMD"
.section ".note.unknown", "a"
.align 4
diff --git a/llvm/test/tools/llvm-readobj/wasm/wasm-imports.test b/llvm/test/tools/llvm-readobj/wasm/wasm-imports.test
index dd93c14fbebe..e8f8c9d9154f 100644
--- a/llvm/test/tools/llvm-readobj/wasm/wasm-imports.test
+++ b/llvm/test/tools/llvm-readobj/wasm/wasm-imports.test
@@ -21,7 +21,7 @@ Sections:
Field: __linear_memory
Kind: MEMORY
Memory:
- Initial: 0x00000000
+ Minimum: 0x00000000
- Module: env
Field: __indirect_function_table
Kind: TABLE
@@ -29,7 +29,7 @@ Sections:
Index: 0
ElemType: FUNCREF
Limits:
- Initial: 0x00000000
+ Minimum: 0x00000000
- Module: red
Field: foo
Kind: FUNCTION
diff --git a/llvm/test/tools/llvm-reduce/Inputs/remove-args.py b/llvm/test/tools/llvm-reduce/Inputs/remove-args.py
new file mode 100755
index 000000000000..fea62c3174e0
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/Inputs/remove-args.py
@@ -0,0 +1,16 @@
+import sys
+
+InterestingArgumentPresent = False
+FunctionCallPresent = False
+
+input = open(sys.argv[1], "r")
+for line in input:
+ if "%interesting" in line:
+ InterestingArgumentPresent = True
+ if "call void @interesting" in line:
+ FunctionCallPresent = True
+
+if InterestingArgumentPresent and FunctionCallPresent:
+ sys.exit(0) # Interesting!
+
+sys.exit(1)
diff --git a/llvm/test/tools/llvm-reduce/Inputs/remove-bbs.py b/llvm/test/tools/llvm-reduce/Inputs/remove-bbs.py
new file mode 100755
index 000000000000..71f099daaba0
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/Inputs/remove-bbs.py
@@ -0,0 +1,15 @@
+import sys
+
+InterestingBBs = 0
+input = open(sys.argv[1], "r")
+for line in input:
+ i = line.find(';')
+ if i >= 0:
+ line = line[:i]
+ if line.startswith("interesting") or "%interesting" in line:
+ InterestingBBs += 1
+
+if InterestingBBs == 6:
+ sys.exit(0) # interesting!
+
+sys.exit(1) # IR isn't interesting
diff --git a/llvm/test/tools/llvm-reduce/Inputs/remove-instructions.py b/llvm/test/tools/llvm-reduce/Inputs/remove-instructions.py
new file mode 100755
index 000000000000..9717c73b01aa
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/Inputs/remove-instructions.py
@@ -0,0 +1,17 @@
+import sys
+
+InterestingInstructions = 0
+
+input = open(sys.argv[1], "r")
+for line in input:
+ i = line.find(';')
+ if i >= 0:
+ line = line[:i]
+ if "%interesting" in line:
+ InterestingInstructions += 1
+ print(InterestingInstructions)
+
+if InterestingInstructions == 5:
+ sys.exit(0) # interesting!
+
+sys.exit(1)
diff --git a/llvm/test/tools/llvm-reduce/Inputs/remove-metadata.py b/llvm/test/tools/llvm-reduce/Inputs/remove-metadata.py
new file mode 100755
index 000000000000..37af33314853
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/Inputs/remove-metadata.py
@@ -0,0 +1,8 @@
+import sys
+
+input = open(sys.argv[1], "r")
+for line in input:
+ if "!interesting" in line:
+ sys.exit(0)
+
+sys.exit(1)
diff --git a/llvm/test/tools/llvm-reduce/do-not-remove-terminator.ll b/llvm/test/tools/llvm-reduce/do-not-remove-terminator.ll
new file mode 100644
index 000000000000..c517781f5547
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/do-not-remove-terminator.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-FINAL %s
+
+; Make sure we do not remove the terminator of the entry block. The interesting
+; check only requires the result to define the function @test.
+
+; Test case for PR43798.
+
+; CHECK-INTERESTINGNESS: define i32 @test
+
+; CHECK-FINAL: define i32 @test
+; CHECK-FINAL-NEXT: entry:
+; CHECK-FINAL-NEXT: ret i32
+
+define i32 @test(i32 %x) {
+entry:
+ %add = add i32 %x, %x
+ ret i32 %add
+}
diff --git a/llvm/test/tools/llvm-reduce/no-replace-intrinsic-callee-with-undef.ll b/llvm/test/tools/llvm-reduce/no-replace-intrinsic-callee-with-undef.ll
new file mode 100644
index 000000000000..f2463459cab6
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/no-replace-intrinsic-callee-with-undef.ll
@@ -0,0 +1,28 @@
+; Intrinsic calls can't be uniformly replaced with undef without invalidating
+; IR (eg: only intrinsic calls can have metadata arguments), so ensure they are
+; not replaced. The whole call instruction can be removed by instruction
+; reduction instead.
+
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2> %t.log
+; RUN: FileCheck -implicit-check-not=uninteresting --check-prefixes=ALL,CHECK-FINAL %s < %t
+
+; Check that the call is removed by instruction reduction passes
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefix=ALL --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck -implicit-check-not=uninteresting --check-prefixes=ALL,CHECK-NOCALL %s < %t
+
+
+declare i8* @llvm.sponentry.p0i8()
+declare void @uninteresting()
+
+; ALL-LABEL: define i8* @interesting(
+define i8* @interesting() {
+entry:
+ ; CHECK-INTERESTINGNESS: call
+ ; CHECK-NOCALL-NOT: call
+
+ ; CHECK-FINAL: %call = call i8* @llvm.sponentry.p0i8()
+ ; CHECK-FINAL-NEXT: ret i8* %call
+ %call = call i8* @llvm.sponentry.p0i8()
+ call void @uninteresting()
+ ret i8* %call
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-alias.ll b/llvm/test/tools/llvm-reduce/remove-alias.ll
new file mode 100644
index 000000000000..8558068366a3
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-alias.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s
+
+; Test handling of 'alias'.
+
+; CHECK-INTERESTINGNESS: define void @fn3
+
+; CHECK-FINAL-NOT: = {{.*}} global
+; CHECK-FINAL-NOT: = alias
+
+; CHECK-FINAL-NOT: @llvm.used
+; CHECK-FINAL-NOT: @llvm.compiler.used
+
+; CHECK-FINAL-NOT: define void @fn1
+; CHECK-FINAL-NOT: define void @fn2
+; CHECK-FINAL: define void @fn3
+; CHECK-FINAL-NOT: define void @fn4
+
+@g1 = global [ 4 x i32 ] zeroinitializer
+@g2 = global [ 4 x i32 ] zeroinitializer
+
+@"$a1" = alias void (), void ()* @fn1
+@"$a2" = alias void (), void ()* @fn2
+@"$a3" = alias void (), void ()* @fn3
+@"$a4" = alias void (), void ()* @fn4
+
+@"$a5" = alias i64, bitcast (i32* getelementptr ([ 4 x i32 ], [ 4 x i32 ]* @g1, i32 0, i32 1) to i64*)
+@"$a6" = alias i64, bitcast (i32* getelementptr ([ 4 x i32 ], [ 4 x i32 ]* @g2, i32 0, i32 1) to i64*)
+
+@llvm.used = appending global [1 x i8*] [
+ i8* bitcast (i64* @"$a5" to i8*)
+], section "llvm.metadata"
+
+@llvm.compiler.used = appending global [1 x i8*] [
+ i8* bitcast (i64* @"$a6" to i8*)
+], section "llvm.metadata"
+
+define void @fn1() {
+ ret void
+}
+
+define void @fn2() {
+ ret void
+}
+
+define void @fn3() {
+ ret void
+}
+
+define void @fn4() {
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-all-of-multiple-args.ll b/llvm/test/tools/llvm-reduce/remove-all-of-multiple-args.ll
new file mode 100644
index 000000000000..671a0f652aaf
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-all-of-multiple-args.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+define i32 @t(i32 %a0, i32 %a1, i32 %a2) {
+; CHECK-ALL-LABEL: @t
+; CHECK-FINAL: () {
+;
+; CHECK-INTERESTINGNESS: ret i32
+; CHECK-FINAL: ret i32 undef
+
+ ret i32 %a1
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-args-2.ll b/llvm/test/tools/llvm-reduce/remove-args-2.ll
new file mode 100644
index 000000000000..25b5b32be38d
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-args-2.ll
@@ -0,0 +1,23 @@
+; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls.
+; This test checks that functions with different argument types are handled correctly
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s --input-file %t
+
+%struct.foo = type { %struct.foo*, i32, i32, i8* }
+
+define dso_local void @bar() {
+entry:
+ ; CHECK-INTERESTINGNESS: call void @interesting(
+ ; CHECK-FINAL: call void @interesting(%struct.foo* null)
+ call void @interesting(i32 0, i8* null, %struct.foo* null, i8* null, i64 0)
+ ret void
+}
+
+; CHECK-ALL: define internal void @interesting
+; CHECK-INTERESTINGNESS-SAME: ({{.*}}%interesting{{.*}}) {
+; CHECK-FINAL-SAME: (%struct.foo* %interesting) {
+define internal void @interesting(i32 %uninteresting1, i8* %uninteresting2, %struct.foo* %interesting, i8* %uninteresting3, i64 %uninteresting4) {
+entry:
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-args-from-declaration.ll b/llvm/test/tools/llvm-reduce/remove-args-from-declaration.ll
new file mode 100644
index 000000000000..f476495c5731
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-args-from-declaration.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-INTERESTINGNESS-LABEL: @interesting(
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-FINAL: declare void @interesting(i32)
+declare void @interesting(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2)
+
+; CHECK-INTERESTINGNESS-LABEL: @interesting2(
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-FINAL: declare void @interesting2(i32)
+declare void @interesting2(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2)
+
+; CHECK-INTERESTINGNESS-LABEL: @callee(
+; CHECK-INTERESTINGNESS-SAME: i32 %interesting
+; CHECK-FINAL: define void @callee(i32 %interesting) {
+define void @callee(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2) {
+; CHECK-INTERESTINGNESS: call void @interesting2(
+; CHECK-INTERESTINGNESS-SAME: i32 %interesting
+; CHECK-FINAL: call void @interesting2(i32 %interesting)
+ call void @interesting2(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2)
+; CHECK-ALL: ret void
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-args-used-by-ret.ll b/llvm/test/tools/llvm-reduce/remove-args-used-by-ret.ll
new file mode 100644
index 000000000000..13b7fe58e5f0
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-args-used-by-ret.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; We can't drop arguments if they are used by terminator instructions.
+
+define i32 @t(i32 %a0, i32 %a1, i32 %a2) {
+; CHECK-ALL-LABEL: @t
+; CHECK-FINAL-NOT: %a1
+;
+; CHECK-INTERESTINGNESS: ret i32
+; CHECK-FINAL: ret i32 undef
+
+ ret i32 %a1
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-args.ll b/llvm/test/tools/llvm-reduce/remove-args.ll
new file mode 100644
index 000000000000..161a6fd3731b
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-args.ll
@@ -0,0 +1,12 @@
+; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls.
+;
+; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-args.py %s -o %t
+; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s
+
+; CHECK: @interesting(i32 %interesting)
+define void @interesting(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2) {
+entry:
+ ; CHECK: call void @interesting(i32 0)
+ call void @interesting(i32 -1, i32 0, i32 -1)
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsic-like-functions.ll b/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsic-like-functions.ll
new file mode 100644
index 000000000000..60df12e94feb
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsic-like-functions.ll
@@ -0,0 +1,40 @@
+; Just because a function is named like an intrinsic does not mean we should skip it's attributes.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-ALL: declare i32 @llvm.not.really.an.intrinsic(i32, i32) #0
+declare i32 @llvm.not.really.an.intrinsic(i32, i32) #0
+
+define i32 @t(i32 %a) {
+; CHECK-ALL-LABEL: @t(
+
+; CHECK-INTERESTINGNESS: %r =
+; CHECK-INTERESTINGNESS-SAME: call
+; CHECK-INTERESTINGNESS-SAME: "arg0"
+; CHECK-INTERESTINGNESS-SAME: i32 @llvm.not.really.an.intrinsic(i32
+; CHECK-INTERESTINGNESS-SAME: "arg3"
+; CHECK-INTERESTINGNESS-SAME: %a
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: %a
+; CHECK-INTERESTINGNESS-SAME: #1
+
+; CHECK-FINAL: %r = call "arg0" i32 @llvm.not.really.an.intrinsic(i32 "arg3" %a, i32 %a) #1
+; CHECK-ALL: ret i32 %r
+
+ %r = call "arg0" "arg1" i32 @llvm.not.really.an.intrinsic(i32 "arg2" "arg3" %a, i32 %a) "arg4" "arg5"
+ ret i32 %r
+}
+
+; CHECK-INTERESTINGNESS: attributes #0 = {
+; CHECK-INTERESTINGNESS-SAME: "arg6"
+
+; CHECK-INTERESTINGNESS: attributes #1 = {
+; CHECK-INTERESTINGNESS-SAME: "arg4"
+
+; CHECK-FINAL: attributes #0 = { "arg6" }
+; CHECK-FINAL: attributes #1 = { "arg4" }
+
+; CHECK-ALL-NOT: attributes #
+
+attributes #0 = { "arg6" "arg7" }
diff --git a/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsics.ll b/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsics.ll
new file mode 100644
index 000000000000..f0ee014ecae5
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-attributes-from-intrinsics.ll
@@ -0,0 +1,38 @@
+; We can't actually put attributes on intrinsic declarations, only on call sites.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+define i32 @t(i32 %a) {
+; CHECK-ALL-LABEL: @t(
+
+; CHECK-INTERESTINGNESS: %r =
+; CHECK-INTERESTINGNESS-SAME: call
+; CHECK-INTERESTINGNESS-SAME: "arg0"
+; CHECK-INTERESTINGNESS-SAME: i32 @llvm.uadd.sat.i32(i32
+; CHECK-INTERESTINGNESS-SAME: "arg3"
+; CHECK-INTERESTINGNESS-SAME: %a
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: %a
+; CHECK-INTERESTINGNESS-SAME: #1
+
+; CHECK-FINAL: %r = call "arg0" i32 @llvm.uadd.sat.i32(i32 "arg3" %a, i32 %a) #1
+; CHECK-ALL: ret i32 %r
+
+ %r = call "arg0" "arg1" i32 @llvm.uadd.sat.i32(i32 "arg2" "arg3" %a, i32 %a) "arg4" "arg5"
+ ret i32 %r
+}
+
+; CHECK-ALL: declare i32 @llvm.uadd.sat.i32(i32, i32) #0
+declare i32 @llvm.uadd.sat.i32(i32, i32) #0
+
+; CHECK-ALL: attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
+
+; CHECK-INTERESTINGNESS: attributes #1 = {
+; CHECK-INTERESTINGNESS-SAME: "arg4"
+
+; CHECK-FINAL: attributes #1 = { "arg4" }
+
+; CHECK-ALL-NOT: attributes #
+
+attributes #0 = { "arg6" "arg7" }
diff --git a/llvm/test/tools/llvm-reduce/remove-bbs-ret-nonvoid.ll b/llvm/test/tools/llvm-reduce/remove-bbs-ret-nonvoid.ll
new file mode 100644
index 000000000000..8a87064315a9
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-bbs-ret-nonvoid.ll
@@ -0,0 +1,29 @@
+; Test that llvm-reduce inserts valid return instructions for functions with
+; on-void return types.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck %s
+
+; CHECK-INTERESTINGNESS: interesting:
+; CHECK-INTERESTINGNESS: interesting2:
+
+define i32 @main(i1 %c) {
+; CHECK-LABEL: define i32 @main() {
+; CHECK-LABEL: interesting:
+; CHECK-NEXT: br label %interesting2
+
+; CHECK-LABEL: interesting2:
+; CHECK-NEXT: ret i32 undef
+
+interesting:
+ br label %interesting2
+
+interesting2:
+ br i1 true, label %uninteresting1, label %uninteresting
+
+uninteresting:
+ br label %uninteresting1
+
+uninteresting1:
+ ret i32 10
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-bbs-unwinded-to.ll b/llvm/test/tools/llvm-reduce/remove-bbs-unwinded-to.ll
new file mode 100644
index 000000000000..375678ec99c9
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-bbs-unwinded-to.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+declare i32 @maybe_throwing_callee()
+
+; CHECK-ALL: declare void @did_not_throw(i32)
+declare void @did_not_throw(i32)
+
+declare void @thrown()
+
+; CHECK-ALL: define void @caller()
+define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-ALL: bb:
+bb:
+; CHECK-INTERESTINGNESS: label %bb3
+; CHECK-FINAL: br label %bb3
+ %i0 = invoke i32 @maybe_throwing_callee()
+ to label %bb3 unwind label %bb1
+
+bb1:
+ landingpad { i8*, i32 } catch i8* null
+ call void @thrown()
+ br label %bb4
+
+; CHECK-ALL: bb3:
+bb3:
+; CHECK-INTERESTINGNESS: call void @did_not_throw(i32
+; CHECK-FINAL: call void @did_not_throw(i32 undef)
+; CHECK-ALL: br label %bb4
+ call void @did_not_throw(i32 %i0)
+ br label %bb4
+
+; CHECK-ALL: bb4:
+; CHECK-ALL: ret void
+bb4:
+ ret void
+}
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/tools/llvm-reduce/remove-bbs.ll b/llvm/test/tools/llvm-reduce/remove-bbs.ll
new file mode 100644
index 000000000000..9e49bc531688
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-bbs.ll
@@ -0,0 +1,29 @@
+; Test that llvm-reduce can remove uninteresting Basic Blocks, and remove them from instructions (i.e. SwitchInst, BranchInst and IndirectBrInst)
+; Note: if an uninteresting BB is the default case for a switch, the instruction is removed altogether (since the default case cannot be replaced)
+;
+; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-bbs.py %s -o %t
+; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s
+
+define void @main() {
+interesting:
+ ; CHECK-NOT: switch i32 0, label %uninteresting
+ switch i32 0, label %uninteresting [
+ i32 0, label %uninteresting
+ ]
+
+uninteresting:
+ ret void
+
+interesting2:
+ ; CHECK: switch i32 1, label %interesting3
+ switch i32 1, label %interesting3 [
+ ; CHECK-NOT: i32 0, label %uninteresting
+ i32 0, label %uninteresting
+ ; CHECK: i32 1, label %interesting3
+ i32 1, label %interesting3
+ ]
+
+interesting3:
+ ; CHECK: br label %interesting2
+ br i1 true, label %interesting2, label %uninteresting
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-call-site-attributes.ll b/llvm/test/tools/llvm-reduce/remove-call-site-attributes.ll
new file mode 100644
index 000000000000..e8f50355812a
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-call-site-attributes.ll
@@ -0,0 +1,38 @@
+; Test that llvm-reduce can remove uninteresting operand bundles from calls.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-ALL: declare i32 @f1(i32, i32)
+declare i32 @f1(i32, i32)
+
+; CHECK-FINAL-LABEL: define i32 @interesting(i32 %arg0, i32 %arg1) {
+; CHECK-FINAL-NEXT: entry:
+; CHECK-FINAL-NEXT: %r = call "attr0" i32 @f1(i32 "attr4" %arg0, i32 %arg1) #0
+; CHECK-FINAL-NEXT: ret i32 %r
+; CHECK-FINAL-NEXT: }
+define i32 @interesting(i32 %arg0, i32 %arg1) {
+entry:
+; CHECK-INTERESTINGNESS-LABEL: @interesting(
+
+; CHECK-INTERESTINGNESS: %r = call
+; CHECK-INTERESTINGNESS-SAME: "attr0"
+; CHECK-INTERESTINGNESS-SAME: i32 @f1(
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: "attr4"
+; CHECK-INTERESTINGNESS-SAME: %arg0
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: %arg1
+; CHECK-INTERESTINGNESS-SAME: #0
+; CHECK-INTERESTINGNESS: ret i32 %r
+
+ %r = call "attr0" "attr1" "attr2" i32 @f1(i32 "attr3" "attr4" "attr5" %arg0, i32 "attr6" "attr7" "attr8" %arg1) #0
+ ret i32 %r
+}
+
+; CHECK-INTERESTINGNESS: attributes #0 = {
+; CHECK-INTERESTINGNESS-SAME: "attr10"
+
+; CHECK-FINAL: attributes #0 = { "attr10" }
+
+attributes #0 = { "attr9" "attr10" "attr11" }
diff --git a/llvm/test/tools/llvm-reduce/remove-dso-local.ll b/llvm/test/tools/llvm-reduce/remove-dso-local.ll
new file mode 100644
index 000000000000..6589057d125c
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-dso-local.ll
@@ -0,0 +1,24 @@
+; Test that llvm-reduce can remove dso_local.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
+
+; CHECK-INTERESTINGNESS: declare
+; CHECK-INTERESTINGNESS-SAME: void @f0
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: i32
+
+; CHECK-FINAL: declare void @f0(i32, i32)
+
+declare dso_local void @f0(i32, i32)
+
+; CHECK-INTERESTINGNESS: declare
+; CHECK-INTERESTINGNESS-SAME: dso_local
+; CHECK-INTERESTINGNESS-SAME: void @f1
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: i32
+
+; CHECK-FINAL: declare dso_local void @f1(i32, i32)
+
+declare dso_local void @f1(i32, i32)
+
diff --git a/llvm/test/tools/llvm-reduce/remove-funcs.ll b/llvm/test/tools/llvm-reduce/remove-funcs.ll
new file mode 100644
index 000000000000..0e6d0eb8242c
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-funcs.ll
@@ -0,0 +1,31 @@
+; Test that llvm-reduce can remove uninteresting functions as well as
+; their InstCalls.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck -implicit-check-not=uninteresting --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+define i32 @uninteresting1() {
+entry:
+ ret i32 0
+}
+
+; CHECK-ALL-LABEL: interesting()
+define i32 @interesting() {
+entry:
+ ; CHECK-INTERESTINGNESS: call i32 @interesting()
+ %call2 = call i32 @interesting()
+ %call = call i32 @uninteresting1()
+ ret i32 5
+}
+
+; CHECK-FINAL-NEXT: entry:
+; CHECK-FINAL-NEXT: %call2 = call i32 @interesting()
+; CHECK-FINAL-NEXT: ret i32 5
+; CHECK-FINAL-NEXT: }
+
+define i32 @uninteresting2() {
+entry:
+ ret i32 0
+}
+
+declare void @uninteresting3()
diff --git a/llvm/test/tools/llvm-reduce/remove-function-arguments-of-funcs-used-in-blockaddress.ll b/llvm/test/tools/llvm-reduce/remove-function-arguments-of-funcs-used-in-blockaddress.ll
new file mode 100644
index 000000000000..f1ad5db49bfb
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-function-arguments-of-funcs-used-in-blockaddress.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-INTERESTINGNESS: define void @func(
+; CHECK-FINAL: define void @func()
+define void @func(i1 %arg) {
+; CHECK-ALL: bb:
+; CHECK-ALL: br label %bb4
+bb:
+ br label %bb4
+
+; CHECK-ALL: bb4
+bb4:
+; CHECK-INTERESTINGNESS; callbr void asm
+; CHECK-INTERESTINGNESS-SAME; blockaddress
+; CHECK-FINAL: callbr void asm sideeffect "", "X"(i8* blockaddress(@func, %bb11))
+; CHECK-ALL: to label %bb5 [label %bb11]
+ callbr void asm sideeffect "", "X"(i8* blockaddress(@func, %bb11))
+ to label %bb5 [label %bb11]
+
+; CHECK-ALL: bb5:
+; CHECK-ALL: br label %bb11
+bb5:
+ br label %bb11
+
+; CHECK-ALL: bb11:
+; CHECK-ALL: ret void
+bb11:
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-function-attributes.ll b/llvm/test/tools/llvm-reduce/remove-function-attributes.ll
new file mode 100644
index 000000000000..4f254d24eca2
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-function-attributes.ll
@@ -0,0 +1,23 @@
+; Test that llvm-reduce can remove uninteresting attributes.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
+
+; CHECK-INTERESTINGNESS: declare
+; CHECK-INTERESTINGNESS-SAME: "attr0"
+; CHECK-INTERESTINGNESS-SAME: void @f0
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: i32
+; CHECK-INTERESTINGNESS-SAME: "attr6"
+; CHECK-INTERESTINGNESS-SAME: #0
+
+; CHECK-FINAL: declare "attr0" void @f0(i32, i32 "attr6") #0
+
+declare "attr0" "attr1" "attr2" void @f0(i32 "attr3" "attr4" "attr5", i32 "attr6" "attr7" "attr8") #0
+
+; CHECK-INTERESTINGNESS: attributes #0 = {
+; CHECK-INTERESTINGNESS-SAME: "attr10"
+
+; CHECK-FINAL: attributes #0 = { "attr10" }
+
+attributes #0 = { "attr9" "attr10" "attr11" }
diff --git a/llvm/test/tools/llvm-reduce/remove-function-bodies-comdat.ll b/llvm/test/tools/llvm-reduce/remove-function-bodies-comdat.ll
new file mode 100644
index 000000000000..b76f439b7425
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-function-bodies-comdat.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+; RUN: opt -verify %t
+
+; CHECK-FINAL-NOT: = comdat
+; CHECK-INTERESTINGNESS: @callee(
+; CHECK-FINAL: declare void @callee()
+
+$foo = comdat any
+
+define void @callee() comdat($foo) {
+ ret void
+}
+
+; CHECK-ALL: define void @caller()
+define void @caller() {
+entry:
+; CHECK-ALL: call void @callee()
+; CHECK-ALL: ret void
+ call void @callee()
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-function-bodies-used-in-globals.ll b/llvm/test/tools/llvm-reduce/remove-function-bodies-used-in-globals.ll
new file mode 100644
index 000000000000..0832456b6bf0
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-function-bodies-used-in-globals.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
+
+; We cannot change the @alias to undef, because it would result in invalid IR
+; (Aliasee should be either GlobalValue or ConstantExpr).
+
+; CHECK-INTERESTINGNESS: @alias =
+; CHECK-FINAL: @alias = alias void (i32), bitcast (void ()* @func to void (i32)*)
+
+@alias = alias void (i32), void (i32)* @func
+
+; CHECK-FINAL: @func()
+
+define void @func(i32 %arg) {
+entry:
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-function-bodies.ll b/llvm/test/tools/llvm-reduce/remove-function-bodies.ll
new file mode 100644
index 000000000000..c70df0e38f3d
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-function-bodies.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-INTERESTINGNESS: @callee(
+; CHECK-FINAL: declare void @callee()
+define void @callee() {
+ ret void
+}
+
+; CHECK-ALL: define void @caller()
+define void @caller() {
+entry:
+; CHECK-ALL: call void @callee()
+; CHECK-ALL: ret void
+ call void @callee()
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-global-variable-attributes.ll b/llvm/test/tools/llvm-reduce/remove-global-variable-attributes.ll
new file mode 100644
index 000000000000..bec3afd960e9
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-global-variable-attributes.ll
@@ -0,0 +1,27 @@
+; Test that llvm-reduce can remove uninteresting attributes.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-ALL: @gv0 = global i32 0 #0
+; CHECK-ALL-NEXT: @gv1 = global i32 0 #1
+; CHECK-ALL-NEXT: @gv2 = global i32 0
+@gv0 = global i32 0 #0
+@gv1 = global i32 0 #1
+@gv2 = global i32 0 #2
+
+; CHECK-INTERESTINGNESS: attributes #0 = {
+; CHECK-INTERESTINGNESS-SAME: "attr0"
+; CHECK-INTERESTINGNESS-SAME: "attr2"
+
+; CHECK-INTERESTINGNESS-NEXT: attributes #1 = {
+; CHECK-INTERESTINGNESS-SAME: "attr4"
+
+; CHECK-FINAL: attributes #0 = { "attr0" "attr2" }
+; CHECK-FINAL-NEXT: attributes #1 = { "attr4" }
+
+; CHECK-FINAL-NOT: attributes #2
+
+attributes #0 = { "attr0" "attr1" "attr2"}
+attributes #1 = { "attr3" "attr4" "attr5"}
+attributes #2 = { "attr6" "attr7" "attr8"}
diff --git a/llvm/test/tools/llvm-reduce/remove-global-vars.ll b/llvm/test/tools/llvm-reduce/remove-global-vars.ll
new file mode 100644
index 000000000000..e791fd50bf7c
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-global-vars.ll
@@ -0,0 +1,56 @@
+; Test that llvm-reduce can remove uninteresting Global Variables as well as
+; their direct uses (which in turn are replaced with 'undef').
+
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL --implicit-check-not=uninteresting %s
+
+$interesting5 = comdat any
+
+; CHECK-INTERESTINGNESS: @interesting = {{.*}}global i32{{.*}}, align 4
+; CHECK-INTERESTINGNESS: @interesting2 = global i32 0, align 4
+; CHECK-INTERESTINGNESS: @interesting3 = {{.*}}global i32{{.*}}, align 4
+; CHECK-INTERESTINGNESS: @interesting4 = {{.*}}constant i32{{.*}}, align 4
+; CHECK-INTERESTINGNESS: @interesting5 = {{.*}}global i32{{.*}}, align 4
+
+; CHECK-FINAL: @interesting = external global i32, align 4
+; CHECK-FINAL: @interesting2 = global i32 0, align 4
+; CHECK-FINAL: @interesting3 = external global i32, align 4
+; CHECK-FINAL: @interesting4 = external dso_local constant i32, align 4
+; CHECK-FINAL: @interesting5 = external global i32, align 4
+@interesting = global i32 0, align 4
+@interesting2 = global i32 0, align 4
+@interesting3 = external global i32, align 4
+@interesting4 = private constant i32 2, align 4
+@interesting5 = global i32 2, align 4, comdat
+
+@uninteresting = global i32 1, align 4
+@uninteresting2 = external global i32, align 4
+
+define i32 @main() {
+entry:
+ %0 = load i32, i32* @uninteresting, align 4
+
+ ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting, align 4
+ ; CHECK-FINAL: store i32 undef, i32* @interesting, align 4
+ store i32 %0, i32* @interesting, align 4
+
+ ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting3, align 4
+ ; CHECK-FINAL: store i32 undef, i32* @interesting3, align 4
+ store i32 %0, i32* @interesting3, align 4
+
+ ; CHECK-ALL: load i32, i32* @interesting, align 4
+ %1 = load i32, i32* @interesting, align 4
+ store i32 %1, i32* @uninteresting, align 4
+
+ ; CHECK-ALL: load i32, i32* @interesting3, align 4
+ %2 = load i32, i32* @interesting3, align 4
+ store i32 %2, i32* @uninteresting2, align 4
+
+ ; CHECK-ALL: store i32 5, i32* @interesting, align 4
+ store i32 5, i32* @interesting, align 4
+
+ ; CHECK-ALL: store i32 5, i32* @interesting3, align 4
+ store i32 5, i32* @interesting3, align 4
+
+ ret i32 0
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-instructions.ll b/llvm/test/tools/llvm-reduce/remove-instructions.ll
new file mode 100644
index 000000000000..5a113e307a12
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-instructions.ll
@@ -0,0 +1,26 @@
+; Test that llvm-reduce can remove uninteresting instructions.
+;
+; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-instructions.py %s -o %t
+; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s
+; REQUIRES: plugins
+
+; We're testing all direct uses of %interesting are conserved. The terminator
+; (ret) must also be preserved.
+
+; CHECK-COUNT-5: %interesting
+; CHECK: ret
+
+define i32 @main() #0 {
+entry:
+ %uninteresting1 = alloca i32, align 4
+ %interesting = alloca i32, align 4
+ %uninteresting2 = alloca i32, align 4
+ store i32 0, i32* %uninteresting1, align 4
+ store i32 0, i32* %interesting, align 4
+ %0 = load i32, i32* %interesting, align 4
+ %uninteresting3 = add nsw i32 %0, 1
+ store i32 %uninteresting3, i32* %interesting, align 4
+ %1 = load i32, i32* %interesting, align 4
+ store i32 %1, i32* %uninteresting2, align 4
+ ret i32 0
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-invoked-functions.ll b/llvm/test/tools/llvm-reduce/remove-invoked-functions.ll
new file mode 100644
index 000000000000..d29185947803
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-invoked-functions.ll
@@ -0,0 +1,55 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-INTERESTINGNESS: define i32 @maybe_throwing_callee(
+; CHECK-FINAL: define i32 @maybe_throwing_callee()
+define i32 @maybe_throwing_callee(i32 %arg) {
+; CHECK-ALL: call void @thrown()
+; CHECK-INTERESTINGNESS: ret i32
+; CHECK-FINAL: ret i32 undef
+ call void @thrown()
+ ret i32 %arg
+}
+
+; CHECK-ALL: declare void @did_not_throw(i32)
+declare void @did_not_throw(i32)
+
+; CHECK-ALL: declare void @thrown()
+declare void @thrown()
+
+; CHECK-INTERESTINGNESS: define void @caller(
+; CHECK-FINAL: define void @caller(i32 %arg)
+define void @caller(i32 %arg) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-ALL: bb:
+bb:
+; CHECK-INTERESTINGNESS: %i0 = invoke i32
+; CHECK-FINAL: %i0 = invoke i32 bitcast (i32 ()* @maybe_throwing_callee to i32 (i32)*)(i32 %arg)
+; CHECK-ALL: to label %bb3 unwind label %bb1
+ %i0 = invoke i32 @maybe_throwing_callee(i32 %arg)
+ to label %bb3 unwind label %bb1
+
+; CHECK-ALL: bb1:
+bb1:
+; CHECK-ALL: landingpad { i8*, i32 }
+; CHECK-ALL: catch i8* null
+; CHECK-ALL: call void @thrown()
+; CHECK-ALL: br label %bb4
+ landingpad { i8*, i32 }
+ catch i8* null
+ call void @thrown()
+ br label %bb4
+
+; CHECK-ALL: bb3:
+bb3:
+; CHECK-ALL: call void @did_not_throw(i32 %i0)
+; CHECK-ALL: br label %bb4
+ call void @did_not_throw(i32 %i0)
+ br label %bb4
+
+; CHECK-ALL: bb4:
+; CHECK-ALL: ret void
+bb4:
+ ret void
+}
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/tools/llvm-reduce/remove-metadata.ll b/llvm/test/tools/llvm-reduce/remove-metadata.ll
new file mode 100644
index 000000000000..51a50ca20a98
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-metadata.ll
@@ -0,0 +1,19 @@
+; Test that llvm-reduce can remove uninteresting metadata from an IR file.
+; The Metadata pass erases named & unnamed metadata nodes.
+;
+; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-metadata.py %s -o %t
+; RUN: cat %t | FileCheck -implicit-check-not=! %s
+
+@global = global i32 0, !dbg !0
+
+define void @main() !dbg !0 {
+ ret void, !dbg !0
+}
+
+!uninteresting = !{!0}
+; CHECK: !interesting = !{!0}
+!interesting = !{!1}
+
+!0 = !{!"uninteresting"}
+; CHECK: !0 = !{!"interesting"}
+!1 = !{!"interesting"}
diff --git a/llvm/test/tools/llvm-reduce/remove-module-inline-asm.ll b/llvm/test/tools/llvm-reduce/remove-module-inline-asm.ll
new file mode 100644
index 000000000000..fa4dba8551f1
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-module-inline-asm.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
+
+; CHECK-INTERESTINGNESS: declare
+
+; CHECK-FINAL-NOT: module asm
+; CHECK-FINAL: declare void @g
+
+module asm "foo"
+
+declare void @g()
diff --git a/llvm/test/tools/llvm-reduce/remove-multiple-use-of-args-in-same-instruction.ll b/llvm/test/tools/llvm-reduce/remove-multiple-use-of-args-in-same-instruction.ll
new file mode 100644
index 000000000000..61bfc3786c95
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-multiple-use-of-args-in-same-instruction.ll
@@ -0,0 +1,17 @@
+; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefix=CHECK-ALL --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-ALL %s < %t
+
+; CHECK-ALL: declare void @use(i32, i32, i32)
+declare void @use(i32, i32, i32)
+
+; CHECK-ALL: @interesting(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3
+define void @interesting(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3) {
+entry:
+ ; CHECK-ALL: call void @use(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3)
+ call void @use(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3)
+ call void @use(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3)
+ call void @use(i32 %uninteresting1, i32 %uninteresting2, i32 %uninteresting3)
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-multiple-use-of-global-vars-in-same-instruction.ll b/llvm/test/tools/llvm-reduce/remove-multiple-use-of-global-vars-in-same-instruction.ll
new file mode 100644
index 000000000000..ba73a68f0de9
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-multiple-use-of-global-vars-in-same-instruction.ll
@@ -0,0 +1,23 @@
+; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefix=CHECK-ALL --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-ALL %s < %t
+
+; CHECK-ALL: @uninteresting1 = global
+; CHECK-ALL: @uninteresting2 = global
+; CHECK-ALL: @uninteresting3 = global
+@uninteresting1 = global i32 0, align 4
+@uninteresting2 = global i32 0, align 4
+@uninteresting3 = global i32 0, align 4
+
+declare void @use(i32*, i32*, i32*)
+
+; CHECK-LABEL: @interesting()
+define void @interesting() {
+entry:
+ ; CHECK-ALL: call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
+ call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
+ call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
+ call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-operand-bundles.ll b/llvm/test/tools/llvm-reduce/remove-operand-bundles.ll
new file mode 100644
index 000000000000..b0f3af6dbc85
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-operand-bundles.ll
@@ -0,0 +1,40 @@
+; Test that llvm-reduce can remove uninteresting operand bundles from calls.
+;
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+; CHECK-ALL: declare void @f1()
+; CHECK-ALL: declare void @f2()
+; CHECK-ALL: declare void @f3()
+declare void @f1()
+declare void @f2()
+declare void @f3()
+
+; CHECK-FINAL-LABEL: define void @interesting(i32 %arg0, i32 %arg1, i32 %arg2) {
+; CHECK-FINAL-NEXT: entry:
+; CHECK-FINAL-NEXT: call void @f1() [ "bundle0"(), "align"(i32 %arg0), "whatever0"() ]
+; CHECK-FINAL-NEXT: call void @f2()
+; CHECK-FINAL-NEXT: call void @f3() [ "align"(i32 %arg2) ]
+; CHECK-FINAL-NEXT: ret void
+; CHECK-FINAL-NEXT: }
+define void @interesting(i32 %arg0, i32 %arg1, i32 %arg2) {
+entry:
+; CHECK-INTERESTINGNESS-LABEL: @interesting(
+
+; CHECK-INTERESTINGNESS: call void @f1()
+; CHECK-INTERESTINGNESS: "bundle0"()
+; CHECK-INTERESTINGNESS: "align"(i32 %arg0)
+; CHECK-INTERESTINGNESS: "whatever0"()
+
+; CHECK-INTERESTINGNESS: call void @f2()
+
+; CHECK-INTERESTINGNESS: call void @f3()
+; CHECK-INTERESTINGNESS: "align"(i32 %arg2)
+
+; CHECK-INTERESTINGNESS: ret
+
+ call void @f1() [ "bundle0"(), "align"(i32 %arg0), "whatever0"() ]
+ call void @f2() [ "align"(i32 %arg1), "whatever1"(), "bundle1"() ]
+ call void @f3() [ "whatever2"(), "bundle2"(), "align"(i32 %arg2) ]
+ ret void
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-single-arg.ll b/llvm/test/tools/llvm-reduce/remove-single-arg.ll
new file mode 100644
index 000000000000..4e33a6eebb67
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-single-arg.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
+
+define i32 @t(i32 %a0) {
+; CHECK-ALL-LABEL: @t
+; CHECK-FINAL: () {
+;
+; CHECK-INTERESTINGNESS: ret i32
+; CHECK-FINAL: ret i32 42
+
+ ret i32 42
+}
diff --git a/llvm/test/tools/llvm-reduce/remove-unused-declarations.ll b/llvm/test/tools/llvm-reduce/remove-unused-declarations.ll
new file mode 100644
index 000000000000..d1e69325c7c4
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-unused-declarations.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefix=CHECK-ALL --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-ALL --implicit-check-not=uninteresting %s < %t
+
+declare void @llvm.uninteresting()
+declare void @uninteresting()
+
+; CHECK-ALL: declare void @llvm.interesting()
+; CHECK-ALL: declare void @interesting()
+declare void @llvm.interesting()
+declare void @interesting()
+
+; CHECK-ALL: define void @main() {
+; CHECK-ALL-NEXT: call void @llvm.interesting()
+; CHECK-ALL-NEXT: call void @interesting()
+; CHECK-ALL-NEXT: ret void
+; CHECK-ALL-NEXT: }
+define void @main() {
+ call void @llvm.interesting()
+ call void @interesting()
+ ret void
+}