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

    <tr>
        <th>Summary</th>
        <td>
            [MLIR] mergeIdenticalBlocks ignores operation type constraints
        </td>
    </tr>

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

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

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

<pre>
    `BlockMergeCluster::merge` (and thereforse `mergeIdenticalBlocks`) seems to ignore potential type constraints that a BranchOpInterface op may have. Since in principle nothing prevents a branch-like op to work only on some particular types, simply appending a new operand to the successor list could cause it to later fail verification. This may show up when using `applyPatternsGreedily`, and while setting an appropriate `RegionSimplificationLevel` may work around it, downstream users may not have control over the region simplification level that is set in upstream passes that use `applyPatternsGreedily`.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U82K4zgQfhrlUnRwlMRJDj5095ChYYYdZvYFynLF1rYsiapyQt5-kRJmYdk9Gezy91NffSjix0jUmf2b2X9Z4aJT4u6HJ-X0dRpXfRrunWmbt5Dc53fikd7DIkpstq9m-zqXN6ZtwNgjxgF0IqZLYiEwbVO_fgwU1TsMFUJM2xh7AiGaBTSBH2Nigpy0jGEAvWcCl6Ioo48qoBMqILwxRjf9kT-iEl_QEaQMM95hwiut4ZePjsBHyOyj8zkQxKSTjyNkpisVJIS-grwE_1l_1wS3xJ-QYrhDiiBpJsjI6t0SkKsWMfYdxM853AFzpjgUTIRIN0iZuNpOxTnI4hyJJIbgRcGlJQzgcBECr2UooBLDBX2AK7G_eIfqU1zDn5OXakamdIMlw22iCIsUKtM2mHO4_0BV4ihfmWjw4V43-Q6F_zb5QCCkWrXFIpRTZo9ag_hJo0_xVzHxm_QbXSmU6Apt3QJyWuIAXgvskG4lAsIZFiF-qItJ67pLPsopQLoSV-tcGR57-k0BoXA8AvRS9JWAlvzEzShCz3yXx8X8n9G1aV5XQ7cdTtsTrqjbHA7toT1u9rvV1LXHox3sYXfCSzO0bev67bEZTnh0dttfDseV72xj22ZnN5tmZ7e79eVCzd5t-n6Hrt8f0OwamtGHdQjXeZ14XHmRhbrNabs5HlYBewpSO2LtHDwba0tbuCvzL_0yitk1JXP5B0G9htqr798-fpr9F_ivNjzPXx6XVHf27_tfLRy6STVLqZw9G3sevU5Lv3ZpNvZcCJ-Pl8zpL3Jq7LnqF2PPTwvXzv4dAAD__3byXqg">