This patch adds more precise side effects to the current ops with memory effects, allowing us to determine which OpOperand/OpResult/BlockArgument the operation reads or writes, rather than just recording the reading and writing of values. This allows for convenient use of precise side effects to achieve analysis and optimization. Related discussions: https://discourse.llvm.org/t/rfc-add-operandindex-to-sideeffect-instance/79243
10 lines
534 B
MLIR
10 lines
534 B
MLIR
// RUN: mlir-opt %s --test-side-effects --verify-diagnostics
|
|
|
|
func.func @test_side_effects(%arg0: memref<2xi32>) -> memref<2xi32> {
|
|
// expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
|
|
// expected-remark @below {{found an instance of 'write' on a op result, on resource '<Default>'}}
|
|
// expected-remark @below {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
|
|
%0 = bufferization.clone %arg0 : memref<2xi32> to memref<2xi32>
|
|
return %0 : memref<2xi32>
|
|
}
|