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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] `transform.include` does not handle nested specs with the same name
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            mlir:transform_dialect
      </td>
    </tr>

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

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

<pre>
    Repro:
```mlir
// RUN: mlir-opt %s --transform-interpreter

module @td_module_4 attributes {transform.with_named_sequence} {
  module @foo_module attributes {transform.with_named_sequence} {
    transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) -> () {
 transform.print {name="foo_module"}
      transform.yield
    }
  }
 module @bar_module attributes {transform.with_named_sequence} {
 transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) -> () {
      transform.print {name="bar_module"}
 transform.yield
    }
  }
  transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) -> () {
 transform.include @foo_module::@__transform_main failures(suppress) (%arg0) : (!transform.any_op) -> ()
    transform.include @bar_module::@__transform_main failures(suppress) (%arg0) : (!transform.any_op) -> ()
    transform.yield
  }
}
```

This prints `[[[ IR printer: foo_module top-level ]]]` only but I'd expect it to also print `[[[ IR printer: bar_module top-level ]]]`.

If I rename the nested specs to `__transform_main1` and `__transform_main2`, both `foo_module` and `bar_module` get printed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVU1v2zwM_jXyhXBgSfFHDj6kzRsgl_dQbGdDtphYm2x5ktwt_36Q49ZpmgHDdugAwYYoinzIh6SEc-rUI5YkfSDpLhKjb40tv46tsFFt5Ll8wsEawrck2ZIsuaxOKxv2bE_YHp4-_0_4FoIwNoMHwlIHceyt6N3R2C5WvUc7WPQ43Uq2nZGjRiDrxMvqsqnWILy3qh49OiD5w-v11Xfl26oXHcrK4bcR-wZJvgs6JNkCLMaOxszW_tQWwKL6VivYr6rX06oTqiesICwV9pSE-Amjy2XRnyszvPVtUUjT6zPJd4RtICb8P5hMbF78L7qDVb0P4oCC8B1hbImOMBZsXABfQz4r1HKWv2jM_yVLtbB_l6UPTdFNxHfytMS35Om3UvSvcK_6Ro_ypqJDB_LtHSBwFEqPFh1hhRuHwaJzk9kFYNhNIIs7OG_gvGuDKzRXmf0oNAt9F9Lm78tguoyXT61yMFWGgyAMoy0sODxdxGgDgqtx4c0Qa3xGDSTdzStLIDAG9ejhQFguAX8M2HhQHrwBoZ2Bufx-7eOq2e77WF0gH45wAIuh7sC3CD06jxLcgI0L3kj2LtU0IBS9vHfGAiT2CLXxbTi_qqPl0hWdWQIn9DNwuYpkyeWGb0SEJc0533Ce50XUlmJTpGmdr5uUrvNE8rSgLEuzIjtykR3TJFIlS9iaMkppRjNarDivaVLXBRXNkaaCk3WCnVB6pfVztzL2FCnnRiwp3aR5EWlRo3bTa8RYPZ5CC7NHwtj05PDtEqZUQmPjg0K6i2wZ7MX1eHJknWjlvFs8eOX19MJNRtJdCP5dgYccSIMOeuOhFb3UNyyEoThx4wJJgalotLpsvR9caIbpMTwp3471qjEdYfsAYP7FgzVfJrj7KV5H2H4O-blkPwMAAP__8X9kUA">