diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-08-04 06:32:45 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-08-04 06:32:45 +0000 |
| commit | 63c3989f6a39034d1ca0f8ecbd35f79606147746 (patch) | |
| tree | 0e1974c3be89486561eec879d6d343cfc2cc7fc0 /llvm/test/CodeGen/MIR/Generic | |
| parent | fc6b6983ac267448d6b5d032f7f226001ab4d6a6 (diff) | |
| download | bcm5719-llvm-63c3989f6a39034d1ca0f8ecbd35f79606147746.tar.gz bcm5719-llvm-63c3989f6a39034d1ca0f8ecbd35f79606147746.zip | |
Move generic MIR tests in their own subdir, requires "native" as well
These tests rely on the native backend to be built-in.
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 243959
Diffstat (limited to 'llvm/test/CodeGen/MIR/Generic')
21 files changed, 603 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/Generic/basic-blocks.mir b/llvm/test/CodeGen/MIR/Generic/basic-blocks.mir new file mode 100644 index 00000000000..17313047576 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/basic-blocks.mir @@ -0,0 +1,49 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses machine functions correctly. + +--- | + + define i32 @foo() { + entry: + ret i32 0 + } + + define i32 @bar() { + start: + ret i32 0 + } + +... +--- +# CHECK: name: foo +# CHECK: body: +# CHECK-NEXT: - id: 0 +# CHECK-NEXT: name: entry +# CHECK-NEXT: alignment: 0 +# CHECK-NEXT: isLandingPad: false +# CHECK-NEXT: addressTaken: false +name: foo +body: + - id: 0 + name: entry +... +--- +# CHECK: name: bar +# CHECK: body: +# CHECK-NEXT: - id: 0 +# CHECK-NEXT: name: start +# CHECK-NEXT: alignment: 4 +# CHECK-NEXT: isLandingPad: false +# CHECK-NEXT: addressTaken: false +# CHECK-NEXT: - id: 1 +# CHECK-NEXT: alignment: 0 +# CHECK-NEXT: isLandingPad: false +# CHECK-NEXT: addressTaken: true +name: bar +body: + - id: 0 + name: start + alignment: 4 + - id: 1 + addressTaken: true +... diff --git a/llvm/test/CodeGen/MIR/Generic/expected-eof-after-successor-mbb.mir b/llvm/test/CodeGen/MIR/Generic/expected-eof-after-successor-mbb.mir new file mode 100644 index 00000000000..25ae5119297 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/expected-eof-after-successor-mbb.mir @@ -0,0 +1,29 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @foo(i32 %a) { + entry: + %0 = icmp sle i32 %a, 10 + br i1 %0, label %less, label %exit + + less: + ret i32 0 + + exit: + ret i32 %a + } + +... +--- +name: foo +body: + - id: 0 + name: entry + # CHECK: [[@LINE+1]]:46: expected end of string after the machine basic block reference + successors: [ '%bb.1.less', '%bb.2.exit 2' ] + - id: 1 + name: less + - id: 2 + name: exit +... diff --git a/llvm/test/CodeGen/MIR/Generic/expected-mbb-reference-for-successor-mbb.mir b/llvm/test/CodeGen/MIR/Generic/expected-mbb-reference-for-successor-mbb.mir new file mode 100644 index 00000000000..ce9192901d7 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/expected-mbb-reference-for-successor-mbb.mir @@ -0,0 +1,29 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @foo(i32 %a) { + entry: + %0 = icmp sle i32 %a, 10 + br i1 %0, label %less, label %exit + + less: + ret i32 0 + + exit: + ret i32 %a + } + +... +--- +name: foo +body: + - id: 0 + name: entry + # CHECK: [[@LINE+1]]:35: expected a machine basic block reference + successors: [ '%bb.1.less', '2' ] + - id: 1 + name: less + - id: 2 + name: exit +... diff --git a/llvm/test/CodeGen/MIR/Generic/frame-info.mir b/llvm/test/CodeGen/MIR/Generic/frame-info.mir new file mode 100644 index 00000000000..c5468f94f33 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/frame-info.mir @@ -0,0 +1,91 @@ +# RUN: llc -start-after machine-sink -stop-after machine-sink -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses machine frame info properties +# correctly. + +--- | + + define i32 @test(i32 %a) { + entry: + %b = alloca i32 + store i32 %a, i32* %b + %c = load i32, i32* %b + ret i32 %c + } + + define i32 @test2(i32 %a) { + entry: + %b = alloca i32 + store i32 %a, i32* %b + %c = load i32, i32* %b + ret i32 %c + } + +... +--- +name: test +isSSA: true +tracksRegLiveness: true + +# CHECK: frameInfo: +# CHECK-NEXT: isFrameAddressTaken: false +# CHECK-NEXT: isReturnAddressTaken: false +# CHECK-NEXT: hasStackMap: false +# CHECK-NEXT: hasPatchPoint: false +# CHECK-NEXT: stackSize: 0 +# CHECK-NEXT: offsetAdjustment: 0 +# Note: max alignment can be target specific when printed. +# CHECK-NEXT: maxAlignment: +# CHECK-NEXT: adjustsStack: false +# CHECK-NEXT: hasCalls: false +# CHECK-NEXT: maxCallFrameSize: 0 +# CHECK-NEXT: hasOpaqueSPAdjustment: false +# CHECK-NEXT: hasVAStart: false +# CHECK-NEXT: hasMustTailInVarArgFunc: false +# CHECK: body +frameInfo: + maxAlignment: 4 +body: + - id: 0 + name: entry +... +--- +name: test2 +isSSA: true +tracksRegLiveness: true + +# CHECK: test2 +# CHECK: frameInfo: +# CHECK-NEXT: isFrameAddressTaken: true +# CHECK-NEXT: isReturnAddressTaken: true +# CHECK-NEXT: hasStackMap: true +# CHECK-NEXT: hasPatchPoint: true +# CHECK-NEXT: stackSize: 4 +# CHECK-NEXT: offsetAdjustment: 4 +# Note: max alignment can be target specific when printed. +# CHECK-NEXT: maxAlignment: +# CHECK-NEXT: adjustsStack: true +# CHECK-NEXT: hasCalls: true +# CHECK-NEXT: maxCallFrameSize: 4 +# CHECK-NEXT: hasOpaqueSPAdjustment: true +# CHECK-NEXT: hasVAStart: true +# CHECK-NEXT: hasMustTailInVarArgFunc: true +# CHECK: body +frameInfo: + isFrameAddressTaken: true + isReturnAddressTaken: true + hasStackMap: true + hasPatchPoint: true + stackSize: 4 + offsetAdjustment: 4 + maxAlignment: 4 + adjustsStack: true + hasCalls: true + maxCallFrameSize: 4 + hasOpaqueSPAdjustment: true + hasVAStart: true + hasMustTailInVarArgFunc: true +body: + - id: 0 + name: entry +... + diff --git a/llvm/test/CodeGen/MIR/Generic/function-missing-machine-function.mir b/llvm/test/CodeGen/MIR/Generic/function-missing-machine-function.mir new file mode 100644 index 00000000000..71b5b284534 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/function-missing-machine-function.mir @@ -0,0 +1,13 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test verifies that an error is reported when a MIR file has some +# function but is missing a corresponding machine function. + +# CHECK: no machine function information for function 'foo' in the MIR file + +--- | + + define i32 @foo() { + ret i32 0 + } + +... diff --git a/llvm/test/CodeGen/MIR/Generic/invalid-jump-table-kind.mir b/llvm/test/CodeGen/MIR/Generic/invalid-jump-table-kind.mir new file mode 100644 index 00000000000..4876f795386 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/invalid-jump-table-kind.mir @@ -0,0 +1,54 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @test_jumptable(i32 %in) { + entry: + switch i32 %in, label %def [ + i32 0, label %lbl1 + i32 1, label %lbl2 + i32 2, label %lbl3 + i32 3, label %lbl4 + ] + + def: + ret i32 0 + + lbl1: + ret i32 1 + + lbl2: + ret i32 2 + + lbl3: + ret i32 4 + + lbl4: + ret i32 8 + } + +... +--- +name: test_jumptable +jumpTable: + # CHECK: [[@LINE+1]]:18: unknown enumerated scalar + kind: switch + entries: + - id: 0 + blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ] +body: + - id: 0 + name: entry + - id: 1 + name: entry + - id: 2 + name: def + - id: 3 + name: lbl1 + - id: 4 + name: lbl2 + - id: 5 + name: lbl3 + - id: 6 + name: lbl4 +... diff --git a/llvm/test/CodeGen/MIR/Generic/lit.local.cfg b/llvm/test/CodeGen/MIR/Generic/lit.local.cfg new file mode 100644 index 00000000000..f3f03bd7047 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/lit.local.cfg @@ -0,0 +1,3 @@ +if 'native' not in config.available_features: + config.unsupported = True + diff --git a/llvm/test/CodeGen/MIR/Generic/llvm-ir-error-reported.mir b/llvm/test/CodeGen/MIR/Generic/llvm-ir-error-reported.mir new file mode 100644 index 00000000000..3508c341c44 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/llvm-ir-error-reported.mir @@ -0,0 +1,22 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures an error is reported if the embedded LLVM IR contains an +# error. + +--- | + + ; CHECK: [[@LINE+3]]:15: use of undefined value '%a' + define i32 @foo(i32 %x, i32 %y) { + %z = alloca i32, align 4 + store i32 %a, i32* %z, align 4 + br label %Test + Test: + %m = load i32, i32* %z, align 4 + %cond = icmp eq i32 %y, %m + br i1 %cond, label %IfEqual, label %IfUnequal + IfEqual: + ret i32 1 + IfUnequal: + ret i32 0 + } + +... diff --git a/llvm/test/CodeGen/MIR/Generic/llvmIR.mir b/llvm/test/CodeGen/MIR/Generic/llvmIR.mir new file mode 100644 index 00000000000..3c084ad7d39 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/llvmIR.mir @@ -0,0 +1,37 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the LLVM IR that's embedded with MIR is parsed +# correctly. + +--- | + ; CHECK: define i32 @foo(i32 %x, i32 %y) + ; CHECK: %z = alloca i32, align 4 + ; CHECK: store i32 %x, i32* %z, align 4 + ; CHECK: br label %Test + ; CHECK: Test: + ; CHECK: %m = load i32, i32* %z, align 4 + ; CHECK: %cond = icmp eq i32 %y, %m + ; CHECK: br i1 %cond, label %IfEqual, label %IfUnequal + ; CHECK: IfEqual: + ; CHECK: ret i32 1 + ; CHECK: IfUnequal: + ; CHECK: ret i32 0 + define i32 @foo(i32 %x, i32 %y) { + %z = alloca i32, align 4 + store i32 %x, i32* %z, align 4 + br label %Test + Test: + %m = load i32, i32* %z, align 4 + %cond = icmp eq i32 %y, %m + br i1 %cond, label %IfEqual, label %IfUnequal + IfEqual: + ret i32 1 + IfUnequal: + ret i32 0 + } + +... +--- +name: foo +body: + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir b/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir new file mode 100644 index 00000000000..80cea5a6fda --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir @@ -0,0 +1,9 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser accepts files without the LLVM IR. + +--- +# CHECK: name: foo +name: foo +body: + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-basic-block-expected-ir-block.mir b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-expected-ir-block.mir new file mode 100644 index 00000000000..2f3d40af792 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-expected-ir-block.mir @@ -0,0 +1,16 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +name: foo +body: + - id: 0 +# CHECK: [[@LINE+1]]:19: expected an IR block reference + ir-block: '0' +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-basic-block-ir-block-reference.mir b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-ir-block-reference.mir new file mode 100644 index 00000000000..ccbab534388 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-ir-block-reference.mir @@ -0,0 +1,19 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser preserves unnamed LLVM IR block +# references. + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +name: foo +body: +# CHECK: id: 0 +# CHECK: ir-block: '%ir-block.0' + - id: 0 + ir-block: '%ir-block.0' +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-basic-block-redefinition-error.mir b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-redefinition-error.mir new file mode 100644 index 00000000000..deac3b0b69b --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-redefinition-error.mir @@ -0,0 +1,17 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @foo() { + entry: + ret i32 0 + } + +... +--- +name: foo +body: + # CHECK: redefinition of machine basic block with id #0 + - id: 0 + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-basic-block-undefined-ir-block.mir b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-undefined-ir-block.mir new file mode 100644 index 00000000000..76d561e61fa --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-undefined-ir-block.mir @@ -0,0 +1,16 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +name: foo +body: + - id: 0 +# CHECK: [[@LINE+1]]:19: use of undefined IR block '%ir-block.10' + ir-block: '%ir-block.10' +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-basic-block-unknown-name.mir b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-unknown-name.mir new file mode 100644 index 00000000000..df8eee9d270 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-basic-block-unknown-name.mir @@ -0,0 +1,19 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that an error is reported whenever the MIR parser can't find +# a basic block with the machine basis block's name. + +--- | + + define i32 @foo() { + entry: + ret i32 0 + } + +... +--- +name: foo +body: + # CHECK: [[@LINE+2]]:18: basic block 'entrie' is not defined in the function 'foo' + - id: 0 + name: entrie +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir new file mode 100644 index 00000000000..0dc7477f627 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir @@ -0,0 +1,15 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser reports an error when it encounters a +# machine function with an empty body. + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +# CHECK: machine function 'foo' requires at least one machine basic block in its body +name: foo +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir new file mode 100644 index 00000000000..424c34aae84 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir @@ -0,0 +1,23 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that an error is reported when the mir file has LLVM IR and +# one of the machine functions has a name that doesn't match any function in +# the LLVM IR. + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +name: foo +body: + - id: 0 +... +--- +# CHECK: function 'faa' isn't defined in the provided LLVM IR +name: faa +body: + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir new file mode 100644 index 00000000000..a868a65d35f --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir @@ -0,0 +1,26 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that an error is reported when a machine function doesn't +# have a name attribute. + +--- | + + define i32 @foo() { + ret i32 0 + } + + define i32 @bar() { + ret i32 0 + } + +... +--- +# CHECK: [[@LINE+1]]:1: missing required key 'name' +nme: foo +body: + - id: 0 +... +--- +name: bar +body: + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-redefinition-error.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-redefinition-error.mir new file mode 100644 index 00000000000..be84161b563 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-function-redefinition-error.mir @@ -0,0 +1,10 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the machine function errors are reported correctly. + +--- +name: foo +... +--- +# CHECK: redefinition of machine function 'foo' +name: foo +... diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function.mir b/llvm/test/CodeGen/MIR/Generic/machine-function.mir new file mode 100644 index 00000000000..afd10ab02c2 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/machine-function.mir @@ -0,0 +1,66 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses machine functions correctly. + +--- | + + define i32 @foo() { + ret i32 0 + } + + define i32 @bar() { + ret i32 0 + } + + define i32 @func() { + ret i32 0 + } + + define i32 @func2() { + ret i32 0 + } + +... +--- +# CHECK: name: foo +# CHECK-NEXT: alignment: +# CHECK-NEXT: exposesReturnsTwice: false +# CHECK-NEXT: hasInlineAsm: false +# CHECK: ... +name: foo +body: + - id: 0 +... +--- +# CHECK: name: bar +# CHECK-NEXT: alignment: +# CHECK-NEXT: exposesReturnsTwice: false +# CHECK-NEXT: hasInlineAsm: false +# CHECK: ... +name: bar +body: + - id: 0 +... +--- +# CHECK: name: func +# CHECK-NEXT: alignment: 8 +# CHECK-NEXT: exposesReturnsTwice: false +# CHECK-NEXT: hasInlineAsm: false +# CHECK: ... +name: func +alignment: 8 +body: + - id: 0 +... +--- +# CHECK: name: func2 +# CHECK-NEXT: alignment: 16 +# CHECK-NEXT: exposesReturnsTwice: true +# CHECK-NEXT: hasInlineAsm: true +# CHECK: ... +name: func2 +alignment: 16 +exposesReturnsTwice: true +hasInlineAsm: true +body: + - id: 0 +... diff --git a/llvm/test/CodeGen/MIR/Generic/register-info.mir b/llvm/test/CodeGen/MIR/Generic/register-info.mir new file mode 100644 index 00000000000..9585faa9622 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/register-info.mir @@ -0,0 +1,40 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses machine register info properties +# correctly. + +--- | + + define i32 @foo() { + entry: + ret i32 0 + } + + define i32 @bar() { + start: + ret i32 0 + } + +... +--- +# CHECK: name: foo +# CHECK: isSSA: false +# CHECK-NEXT: tracksRegLiveness: false +# CHECK-NEXT: tracksSubRegLiveness: false +# CHECK: ... +name: foo +body: + - id: 0 +... +--- +# CHECK: name: bar +# CHECK: isSSA: false +# CHECK-NEXT: tracksRegLiveness: true +# CHECK-NEXT: tracksSubRegLiveness: true +# CHECK: ... +name: bar +isSSA: false +tracksRegLiveness: true +tracksSubRegLiveness: true +body: + - id: 0 +... |

