<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60970>60970</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR]Bug on `-one-shot-bufferize`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sweead
</td>
</tr>
</table>
<pre>
Executing the following optimization will generate invalid IRs.
cmd:
```
mlir-opt -one-shot-bufferize="allow-unknown-ops" core-ops.mlir
```
IR:
```
func.func @affine_apply() {
%i = "arith.constant"() {value = 0: index} : () -> index
%j = "arith.constant"() {value = 1: index} : () -> index
%a = "affine.apply" (%i) { map = affine_map<(d0) -> (d0 + 1)> } :
(index) -> (index)
%b = affine.apply affine_map<()[x] -> (x+1)>()[%i]
return
}
```
Outputs:
```
module {
func.func @affine_apply1() {
return
}
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMFuqzoQ_ZphY4GcAZOwYNE8GqnSe3pSf-DKwATca2yE7Sbt119BaJKrtotKkeOxz5xz7BkjnVOdISpB7EFUkQy-t1PpTkSyjWrbvpWPZ2qCV6Zjvid2tFrb0xzZ0atBvUuvrGEnpTXryNAkPTFlXqVWLXt6dgnwCvjDZWyGFtJ1Djlff0s4aDXFdvQstoZi11sf1-F4pEm9E6QVIMpZOA7mt7EnE9vRASJr7ETzPJnzvyR-ev5O8hhMk8wDg4zL41EZ-iXHUb8B7gALBtv9BcgYoFAM0orNPibl-6SxxnlpPCDe4K9SB1pwHNIHpkxLZ9hWbA5WVAzp47px4375EffmR9zyyr2cMFlPiJckoVZ6NshxQa4XMcgR0n8Ady2_Ui8RA9yzDWCxrFwMfMjNgruLgbucj4U7U_Wd1MXRJ905QezPIKor0RlwvypfAcsRRLVyT-TDZNZqb6svy_5_8GPw7ttGtG3QdF_8b_tk87lR2F8WGLuZ-OQmasu0LdJCRlRu8u0WcbfJs6gvW8qalmRaYL3JGyxyIZqdaJoC040UyCNVIseUI2Z8l2GWJdTIgrbtrpZFhuKYQsZpkEonWr8OiZ26SDkXqMx5seWRljVpt7x4REMntmzOzSaqaCrnnLgOnYOMa-W8u7F45fXyqfjv36dnENU-dMwaBjn_6tXmPAqTLnvvx-W28QB46JTvQ500dgA8zMTrXzxO9oUaD3hY7DjAw2L3TwAAAP__xQNL8w">