brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · e208881 Raw
116 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s2 3//===----------------------------------------------------------------------===//4// Test the number of regions5//===----------------------------------------------------------------------===//6 7func.func @correct_number_of_regions() {8    // CHECK: test.two_region_op9    "test.two_region_op"()(10      {"work"() : () -> ()},11      {"work"() : () -> ()}12    ) : () -> ()13    return14}15 16// -----17 18func.func @missing_regions() {19    // expected-error@+1 {{expected 2 regions}}20    "test.two_region_op"()(21      {"work"() : () -> ()}22    ) : () -> ()23    return24}25 26// -----27 28func.func @extra_regions() {29    // expected-error@+1 {{expected 2 regions}}30    "test.two_region_op"()(31      {"work"() : () -> ()},32      {"work"() : () -> ()},33      {"work"() : () -> ()}34    ) : () -> ()35    return36}37 38// -----39 40//===----------------------------------------------------------------------===//41// Test SizedRegion42//===----------------------------------------------------------------------===//43 44func.func @unnamed_region_has_wrong_number_of_blocks() {45    // expected-error@+1 {{region #1 failed to verify constraint: region with 1 blocks}}46    "test.sized_region_op"() (47    {48        "work"() : () -> ()49        cf.br ^next150      ^next1:51        "work"() : () -> ()52    },53    {54        "work"() : () -> ()55        cf.br ^next256      ^next2:57        "work"() : () -> ()58    }) : () -> ()59    return60}61 62// -----63 64// Test region name in error message65func.func @named_region_has_wrong_number_of_blocks() {66    // expected-error@+1 {{region #0 ('my_region') failed to verify constraint: region with 2 blocks}}67    "test.sized_region_op"() (68    {69        "work"() : () -> ()70    },71    {72        "work"() : () -> ()73    }) : () -> ()74    return75}76 77// -----78 79// Region with single block and not terminator.80// CHECK: unregistered_without_terminator81"test.unregistered_without_terminator"() ({82  ^bb0:83}) : () -> ()84 85// -----86 87// CHECK: test.single_no_terminator_op88"test.single_no_terminator_op"() (89  {90    %foo = arith.constant 1 : i3291  }92) : () -> ()93 94// CHECK: test.variadic_no_terminator_op95"test.variadic_no_terminator_op"() (96  {97    %foo = arith.constant 1 : i3298  },99  {100    %bar = arith.constant 1 : i32101  }102) : () -> ()103 104// CHECK: test.single_no_terminator_custom_asm_op105// CHECK-NEXT: important_dont_drop106test.single_no_terminator_custom_asm_op {107  "important_dont_drop"() : () -> ()108}109 110// -----111 112// CHECK: test.dummy_op_with_region_ref113test.dummy_op_with_region_ref {114  ^bb0:115}116