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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] SymbolTable should respect SymbolOpInterface
        </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>
    At this point in time, SymbolOpInterface isn't really a proper interface, but used more as a trait for convenient access to `SymbolTable` methods. A symptom of this is that overwriting most of it's symbol related functions such as `setName`, `getNameAttr` etc. is pretty useless. This is because all of the methods in `SymbolTable` don't actually make use of `SymbolOpInterface` but instead use direct access to the `sym_visibility` and `sym_name` attributes on the operation.

I think the cleanest approach would be for `SymbolTable` to work on `SymbolOpInterface` and that the default implementations of `SymbolOpInterface` access `sym_visibility` and `sym_name` by default. The only con of this approach however would be that unregistered ops would no longer be capable of being a symbol. 
One could workaround this by also doing the direct attribute access for ops that are not `SymbolOpInterface` at the cost of code duplication between that case and the default implementations in `SymbolOpInterface`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVEuPmzAQ_jXkYhURWPI4cEi7qrSX7qF7rwYzAXeNjewhUfrrO2OS3ZVWqaqggPE8vseY1neX5kCKBhPV5I0jZZwiM2JWflM_L2Pr7fP05AjDETQqE11WbkkFBGsvCtQU_ISBk64RktbOpOaInRp9QAWRwyiAIXX0QWnvTugMcifQGmNU5FW2KZZeL9Ba5JUakQbfxVwdVLyME_lR-eMCky8agJQ_YTgHQ8b13CmSBBhieFFSuBijtECM4zg7TcY73pj1IIi4RUT6AaM0E8x865cXB6IgCJB0Lr2mgEQXIWQZba5erhha1MAvFQuxQMMbaJHwM6POL9KBpjmJN8IrSlnJfgv_ILYkiZTGRULoUmhnAuqPyklbIXMZf51MNK2xhi6SCa67bbiFpgJmZrgiRuVdyhTvQJTJs-IxKw7L_5Po7F5ThLYIDllcmNhqYPXOfrYds09ufqbJmM4-vEqHe6QEWnJQGnR4hNkyy3GyOPJYwOLUP0S5sv9f2u3l1kTMY9KOxecxfBuoN2qDPyMP1TvFhHJ2AXvDHgQeJT_F67bzynrXczgHaphEACnZogwkXGcwV4umz46DUp6oA8HPSQSZIz5GNnqeD8lLklxNvtl1IyyCS_-ECvhoOU_3RVrk1deDoX3HhefJGp0EZph0RnRLMQ0yyAnRfUfMXUfzVddU3b7aw4oMWWyy-utoTcjqR_VhPFQckgIB4yQEP5VazcE2A9EUs-qQld_56g0Nc5trP_LC2tPt9oUt-81FeGlinDHyQ73h32podusOyl1VtdWu3e0fsF639b7W66ooYL1flysLLdooKLOyTECrg-ZvFa8Y8so0ZVGWxXa9WZdlXT_kXbFvN_pYVQVsq67eZg8FjmBsLkhyH_pVaBKodu4jb1qelvi-CTGa3mGSRerDzJ-J0PzB4Pfr7W6VCDQJ_V-7Gezy">