diff options
| author | Michael Liao <michael.hliao@gmail.com> | 2021-05-25 20:21:21 -0400 |
|---|---|---|
| committer | Michael Liao <michael.hliao@gmail.com> | 2021-06-28 22:29:36 -0400 |
| commit | e818eface8034040fbea7ce2f05761944b2d53b1 (patch) | |
| tree | fc09326c463742570757eecea8f25d8611a5bc62 /llvm/test/CodeGen/MIR/Generic | |
| parent | 31eb696fc4cd3b1ed8054d88af54f214c0f92989 (diff) | |
[MIRParser] Add machine metadata.
- Add standalone metadata parsing support so that machine metadata nodes
could be populated before and accessed during MIR is parsed.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D103282
Diffstat (limited to 'llvm/test/CodeGen/MIR/Generic')
9 files changed, 136 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err0.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err0.mir new file mode 100644 index 000000000000..0502ac90e51e --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err0.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '9 = distinct !{!9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:6: expected a metadata node diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err1.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err1.mir new file mode 100644 index 000000000000..4ac5202527d2 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err1.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '! = distinct !{!9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:8: expected metadata id after '!' diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err2.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err2.mir new file mode 100644 index 000000000000..0e731b12c645 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err2.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct {!9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:20: expected a metadata node diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err3.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err3.mir new file mode 100644 index 000000000000..deb06f5f4aba --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err3.mir @@ -0,0 +1,16 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !{!9, !7, !"Dst"}' + - '!9 = distinct !{!9, !7, !"Src"}' +... +# CHECK: [[@LINE-2]]:37: Metadata id is already used diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err4.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err4.mir new file mode 100644 index 000000000000..a28f631b0df0 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err4.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !!9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:21: expected '{' here diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err5.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err5.mir new file mode 100644 index 000000000000..68ab8bc58d86 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err5.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !{!9, !7, !"Dst"' +... +# CHECK: [[@LINE-2]]:36: expected end of metadata node diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err6.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err6.mir new file mode 100644 index 000000000000..51cca1b259cd --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err6.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !{9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:22: expected '!' here diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err7.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err7.mir new file mode 100644 index 000000000000..0cc5ef1b8af8 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err7.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !{!, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:23: expected metadata id after '!' diff --git a/llvm/test/CodeGen/MIR/Generic/machine-metadata-err8.mir b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err8.mir new file mode 100644 index 000000000000..1d51dbc5d659 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-metadata-err8.mir @@ -0,0 +1,15 @@ +# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser detects errors when parsing machine +# metadata. + +--- | + define i32 @t0() { + ret i32 0 + } +... +--- +name: t0 +machineMetadataNodes: + - '!9 = distinct !{!9, !7, !"Dst"}' +... +# CHECK: [[@LINE-2]]:26: use of undefined metadata '!7' |
