brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · b652ecb Raw
61 lines · plain
1// RUN: mlir-opt %s -test-side-effects -verify-diagnostics2 3func.func @side_effect(%arg : index) {4  // expected-remark@+1 {{operation has no memory effects}}5  %0 = "test.side_effect_op"() {} : () -> i326  7  // expected-remark@+2 {{found an instance of 'read' on resource '<Default>'}}8  // expected-remark@+1 {{found an instance of 'free' on resource '<Default>'}}9  %1 = "test.side_effect_op"() {effects = [10    {effect="read"}, {effect="free"}11  ]} : () -> i3212  13  // expected-remark@+1 {{found an instance of 'write' on resource '<Test>'}}14  %2 = "test.side_effect_op"() {effects = [15    {effect="write", test_resource}16  ]} : () -> i3217  18  // expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Test>'}}19  %3 = "test.side_effect_op"() {effects = [20    {effect="allocate", on_result, test_resource}21  ]} : () -> i3222  23  // expected-remark@+1 {{found an instance of 'read' on a symbol '@foo_ref', on resource '<Test>'}}24  "test.side_effect_op"() {effects = [25    {effect="read", on_reference = @foo_ref, test_resource}26  ]} : () -> i3227  28  // No _memory_ effects, but a parametric test effect.29  // expected-remark@+2 {{operation has no memory effects}}30  // expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}31  %4 = "test.side_effect_op"() {32    effect_parameter = affine_map<(i, j) -> (j, i)>33  } : () -> i3234  35  // Check with this unregistered operation to test the fallback on the dialect.36  // expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}37  %5 = "test.unregistered_side_effect_op"() {38    effect_parameter = affine_map<(i, j) -> (j, i)>39  } : () -> i3240 41  // expected-remark@+1 {{found an instance of 'allocate' on op operand 0, on resource '<Test>'}}42  %6 = test.side_effect_with_region_op (%arg) {43  ^bb0(%arg0 : index):44    test.region_yield %arg0 : index 45  } {effects = [ {effect="allocate", on_operand, test_resource} ]} : index -> index46 47  // expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Test>'}}48  %7 = test.side_effect_with_region_op (%arg) {49  ^bb0(%arg0 : index):50    test.region_yield %arg0 : index 51  } {effects = [ {effect="allocate", on_result, test_resource} ]} : index -> index52 53  // expected-remark@+1 {{found an instance of 'allocate' on block argument 0, on resource '<Test>'}}54  %8 = test.side_effect_with_region_op (%arg) {55  ^bb0(%arg0 : index):56    test.region_yield %arg0 : index 57  } {effects = [ {effect="allocate", on_argument, test_resource} ]} : index -> index58 59  func.return 60}61