brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · c61847b Raw
61 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns="test-legalize-mode=full" -split-input-file -verify-diagnostics %s | FileCheck %s2 3// Test that region inlining can be properly undone.4 5// CHECK-LABEL: func @test_undo_region_inline() {6//       CHECK:    "test.region"() ({7//       CHECK:    ^{{.*}}(%[[arg0:.*]]: i64):8//       CHECK:      cf.br ^[[bb1:.*]](%[[arg0]] : i64)9//       CHECK:    ^[[bb1]](%[[arg1:.*]]: i64):10//       CHECK:      "test.invalid"(%[[arg1]]) : (i64) -> ()11//       CHECK:    }) : () -> ()12//       CHECK:    "test.return"() : () -> ()13//       CHECK: }14 15// expected-remark@+1 {{applyFullConversion failed}}16builtin.module {17func.func @test_undo_region_inline() {18  "test.region"() ({19    ^bb1(%i0: i64):20      // expected-error@+1 {{failed to legalize operation 'cf.br'}}21      cf.br ^bb2(%i0 : i64)22    ^bb2(%i1: i64):23      "test.invalid"(%i1) : (i64) -> ()24  }) {} : () -> ()25 26  "test.return"() : () -> ()27}28}29 30// -----31 32// Test that multiple block erases can be properly undone.33 34// CHECK-LABEL: func @test_undo_block_erase() {35//       CHECK:   "test.region"() ({36//       CHECK:   ^{{.*}}(%[[arg0:.*]]: i64):37//       CHECK:     cf.br ^[[bb2:.*]](%[[arg0]] : i64)38//       CHECK:   ^[[bb1:.*]](%[[arg1:.*]]: i64):39//       CHECK:     "test.invalid"(%[[arg1]]) : (i64) -> ()40//       CHECK:   ^[[bb2]](%[[arg2:.*]]: i64):41//       CHECK:     cf.br ^[[bb1]](%[[arg2]] : i64)42//       CHECK:   }) {legalizer.erase_old_blocks, legalizer.should_clone} : () -> ()43//       CHECK:   "test.return"() : () -> ()44//       CHECK: }45 46// expected-remark@+1 {{applyFullConversion failed}}47builtin.module {48func.func @test_undo_block_erase() {49  // expected-error@+1 {{failed to legalize operation 'test.region'}}50  "test.region"() ({51    ^bb1(%i0: i64):52      cf.br ^bb3(%i0 : i64)53    ^bb2(%i1: i64):54      "test.invalid"(%i1) : (i64) -> ()55    ^bb3(%i2: i64):56      cf.br ^bb2(%i2 : i64)57  }) {legalizer.should_clone, legalizer.erase_old_blocks} : () -> ()58  "test.return"() : () -> ()59}60}61