File: transform-state-extension.mlir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (89 lines) | stat: -rw-r--r-- 3,170 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// RUN: mlir-opt %s -test-transform-dialect-interpreter -verify-diagnostics -split-input-file

// expected-note @below {{associated payload op}}
module {
  transform.sequence failures(propagate) {
  ^bb0(%arg0: !transform.any_op):
    // expected-remark @below {{extension absent}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
    test_add_test_extension "A"
    // expected-remark @below {{extension present, A}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
    test_remove_test_extension
    // expected-remark @below {{extension absent}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
  }
}

// -----

// expected-note @below {{associated payload op}}
module {
  transform.sequence failures(propagate) {
  ^bb0(%arg0: !transform.any_op):
    test_add_test_extension "A"
    test_remove_test_extension
    test_add_test_extension "B"
    // expected-remark @below {{extension present, B}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
  }
}

// -----

// expected-note @below {{associated payload op}}
module {
  transform.sequence failures(propagate) {
  ^bb0(%arg0: !transform.any_op):
    test_add_test_extension "A"
    // expected-remark @below {{extension present, A}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
    // expected-note @below {{associated payload op}}
    test_remap_operand_to_self %arg0 : (!transform.any_op) -> !transform.any_op
    // expected-remark @below {{extension present, A}}
    test_check_if_test_extension_present %arg0 : !transform.any_op
  }
}

// -----

transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
  test_add_test_extension "A"
   // This is okay because we are replacing the top-level module operation
   // (0 results) with this operation that has _more_ (1) results.
  %dummy = test_remap_operand_to_self %arg0 : (!transform.any_op) -> !transform.any_op
}

// -----

transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
  test_add_test_extension "A"
  %dummy = test_remap_operand_to_self %arg0 : (!transform.any_op) -> !transform.any_op
  // This is still okay. Even though we are replacing the previous
  // operation with (1 result) with this operation that has less (0) results,
  // there is no handle to the result, hence no issue with value handle update.
  test_remap_operand_to_self %dummy : (!transform.any_op) -> !transform.any_op
}

// -----

transform.sequence failures(propagate) {
^bb0(%arg0: !transform.any_op):
  test_add_test_extension "A"
  // expected-error @below {{cannot replace an op with another op producing fewer results while tracking handles}}
  %dummy = test_remap_operand_to_self %arg0 : (!transform.any_op) -> !transform.any_op
  %valuehandle = transform.get_result %dummy[0] : (!transform.any_op) -> !transform.any_value
  test_remap_operand_to_self %dummy : (!transform.any_op) -> ()
}

// -----

module {
  transform.sequence failures(suppress) {
  ^bb0(%arg0: !transform.any_op):
    // expected-error @below {{TestTransformStateExtension missing}}
    test_remap_operand_to_self %arg0 : (!transform.any_op) -> !transform.any_op
  }
}