<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54929>54929</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] Cloning a Region into itself is currently unsupported
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir:core
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zero9178
      </td>
    </tr>
</table>

<pre>
    Currently, cloning a region into itself is unsupported and guarded by an assert:
https://github.com/llvm/llvm-project/blob/46a13a0ef847dbe3226f4b3d8726ef25c8909293/mlir/lib/IR/Region.cpp#L76-L79
I am wondering whether this restriction is necessary? 

The specific use case where I am hitting this assert is when I am using `mlir::inlineCall` and try to do a single iteration of inlining a directly recursive call into itself. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUsFunDAQ_Rq4WEFgG1gOHLYbRYqU06o_YOwBXHltZJtE9Os7Nk2bQy-V0NjDzDzevMfk1DHedu_BRnMU9EakcVbbhQjiYdHOEm2jIzoGMDPRgew27NvmfARFhFVk2YVXeJ8OTIkIAXws2LWon4v6usa4hZTRF3wWHdd9qqR7YGLM--fxtHn3A2TEdDJuwoN3omGihvnCezUBo7Sb-cTUpacdzLSVl6Ee6MCw9WG0Tzg6zb3eMdwz70puW0HZW989vfXDSeeViAf5cFaBTyt-rBBX8CSuuJeHEL2WMa8ciAUJIQh_FOyFnNNn_L4CCRtIPWtJ9gBECgwI5YFk_FXHmNAz6qlHAsQOezbsIZWLrs7UURx21dZoCzdhDL7OskZ_ENRdOTQi9RtAD8CLzM-hE2ni9Elpj-KZA1eQuw_6PXEy5qtxFSnVyNTABlFGHQ2MRfstf759Jrc_jt__6bj8_D2-el_u3oz_ba8OYYeAl5ajfeU6UtaqZuoZdA00vFPQqKmTqr_Mqu2nlpZGTGBColtQ-lsw6TxghtxLPdKa0po3bVPXvGUVF9B0reC8n1ve1bzgNTyENlViUjm_lH7MpKZ9CVg0OsTwt4h-6cVC1ifhiz2uzo8_wbuh6S9lXmDM7H8B-G4RYQ">