<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60940>60940</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
both of affine.ama_op and memref.dma_op missing sideeffect traits
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lipracer
</td>
</tr>
</table>
<pre>
When I write the dataflow analysis to eliminate the common express`memref.dma_start %arg1[%8], %2[%c0], %14, %15[%c0] : memref<9408xf32>, memref<192xf32, 2>, memref<0xf32, 2>` and `memref.dma_start %arg1[%8], %2[%c0], %14, %16[%c0] : memref<9408xf32>, memref<192xf32, 2>, memref<0xf32, 2>`.I think the `dma.startOp`'s `srcMemref` should has `ReadEffect` and the `dstMemref` should has the `writeEffect`,but unfortunate those has not yet.
```
func.fuc @main(%arg0: memref<1xf32>, %arg1: memref<9408xf32>, %arg2: memref<9408xf32>, %arg3: memref<9408xf32>, %arg4: memref<9408xf32>, %arg5: memref<9408xf32>) {
%c32 = arith.constant 32 : index
%c9408 = arith.constant 9408 : index
%c-2048 = arith.constant -2048 : index
%c2048 = arith.constant 2048 : index
%c-32 = arith.constant -32 : index
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%0 = memref.alloc() {alignment = 16 : i64} : memref<1024xf32, 2>
%1 = memref.subview %0[960] [1] [1] : memref<1024xf32, 2> to memref<1xf32, #map, 2>
%2 = memref.subview %0[0] [192] [1] : memref<1024xf32, 2> to memref<192xf32, 2>
%3 = call @cluster_id() : () -> index
%4 = call @core_id() : () -> index
%5 = memref.alloc() {alignment = 16 : i64} : memref<0xf32, 2>
memref.dma_start %arg0[%c0], %1[%c0], %c1, %5[%c0] : memref<1xf32>, memref<1xf32, #map, 2>, memref<0xf32, 2>
%6 = arith.muli %3, %c2048 : index
%7 = arith.muli %4, %c32 : index
%8 = arith.addi %6, %7 : index
%9 = arith.muli %3, %c-2048 : index
%10 = arith.muli %4, %c-32 : index
%11 = arith.addi %9, %10 : index
%12 = arith.addi %11, %c9408 : index
%13 = arith.cmpi slt, %12, %c32 : index
%14 = select %13, %12, %c32 : index
%15 = memref.alloc() {alignment = 16 : i64} : memref<0xf32, 2>
memref.dma_start %arg1[%8], %2[%c0], %14, %15[%c0] : memref<9408xf32>, memref<192xf32, 2>, memref<0xf32, 2>
%16 = memref.alloc() {alignment = 16 : i64} : memref<0xf32, 2>
memref.dma_start %arg1[%8], %2[%c0], %14, %16[%c0] : memref<9408xf32>, memref<192xf32, 2>, memref<0xf32, 2>
return
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMV19vozgQ_zTmxQryPyA88NA2G2kfTifdyz1WxpjgO2NHttm23_6ECV3SQqo97WorRQJmfr-Z8Yxn7HDv1clIWYHsHmSHhA-hs67S6uy4kC6pbfNS_d1JA7_CJ6eChKGTsOGBt9o-QW64fvHKw2Ch1KpXhl8gwva9NVA-n530HuSol72Tbdr0_NEH7gIEJOPuhEfHJNuD7ADIwygkk0Sg7yLM5pdsoYSA3sHJLKAPJUP755YSQL-M4Fc5LkkUkwf4ToeuNDmC3DTwp8Wa_9JY068wdMr8G7MNctT0PI3B_nkGOQKk8KPUO_HHZCFH0Hd20A3seFT9JXnzpW2lCPPKZ0s-rHIu6rgNXomAPNRDgINprQvDpfzWy8gwNsAXGVKADgDdjejpFz8hbAcj0nYQEDDUc2UA2U-JRlfZwotUzYW4kc0JQj6G0I8h7GNItg0pIQTF_bxaOBIEJRDQA-ROhS4V1vjATYBRegeVaeTzNX40uMa4yFc5O4LYKmlWrLK2SKuc6GZ9LbvtxaA1PNpC4zU03kBPpi-Ny7W2Iu6mcqwA1-pkemlCxOB8MpEzULzpS4wIu2qzpQe89OCH-puST9EzyO7LfGry7B5fPW8ZH2fmmz0eNxXt-Xk1AHIjgFf3JfmfAbwZPUvHNDoWXOuxU4UefJDuUTVzhum4H-LrbjT7vjjs2o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