--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
+
--- /dev/null
+# 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
+ }
+
+...
--- /dev/null
+# 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
+...
--- /dev/null
+if 'native' not in config.available_features:
+ config.unsupported = True
+
--- /dev/null
+# 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
+ }
+
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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'
+...
--- /dev/null
+# 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'
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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'
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
--- /dev/null
+# 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
+...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
-
+++ /dev/null
-# 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
- }
-
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
- }
-
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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'
-...
+++ /dev/null
-# 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'
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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'
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...
+++ /dev/null
-# 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
-...