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

    <tr>
        <th>Summary</th>
        <td>
            [UTC] Match the names of named globals
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            testing-tools
      </td>
    </tr>

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

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

<pre>
    We currently glob the names of IR values since they are not stable. Named global IR values (i.e. `@ my_global` as opposed to `@0`) are sometimes part of the visible symbols and should be matched by their literal name just like functions. It could be argued that some named globals don't need to be matched against since they don't end up in the symbol table, while I don't have a strong opinion on that, I think matching against those names is still safe because they tend to be stable (but I may be wrong), so we don't need to check whether they are `private` etc.

Example:
```
@G = global i32 1

; current checker
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = global i32 1

; literal checker
; CHECK: @G = global i32 1
```

This can already be done by using  `-p` a.k.a. `--preserve-names`, but that affects the entire IR, not just named globals.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVE2P4zYM_TXyhbBhy04yPvgwk2y2QdEeFlsU6GUh24ytjSwZIp1p-usLyZP5aNEuEFhQROo98j1KEenBIjZi8yQ2h0QtPDrfjNZfDJFNWtffmt8RusV7tGxuMBjXAo8IVk1I4M5w-gJXZRYkIG07DIc3UB7BOgZi1RrM4Fc1YR-TlXmXIeSDzjADsc1FlcN0-7aGiG0OisDNsyPsgd1LRB4WWcfryU3IOpCYlefAJNC6atKtQaDb1DpDoGwPNLrF9NAiTIq7EXtobyFYezCa0SsTq4HvCzEYfUE4L7Zj7SxlcGLo7unKD0ugMyqO8DHtXhZB76yQOwaLK-d3gGpQ2hK_b9E9Gm0PywzaRv4rb4htE3IPz6M2CKfX6FFdERQQe2cHcLO22llwNpIKCSfgUdvLiqzt8ArNo6O7bJqAWBsDpM4ILXZqoRdaHPis5FfxgkjtwnCCSd3C388BWsg6oJGDZ_xX4d2I3QWeR-QR_ZshxDafvb4qxqAvcpeJ_CDyx_X76U81zQZF-bIPUq-_dVvln0GUh7uJdCmheJ8vyqe7T1cC6N8O9j992v8sykcQVR69_vQ5AG2eVPrXY_pHntbfhKyElGKzF5t9lorNQcgwE2Jz-CHs3UX_C_uf7P9RZ_x-HTVBpywo41H1se-9sxicu1CQNXQzneOgZJdMxRlK09kjob9iGnWO07KHoF70rDqfsWOKRkPL2iOcvoSIMKrR_R8MnSV9U_Z1WasEm2JbPxSbnSx2ydgU221ZqLzu-6otqp16qLHt267uH3bbHfZ5ohuZy7LIZVVUMi92WVvItlRVJ2Wp6rI6iyrHSWmTGXOdMueHRBMt2OzyvNolRrVoKL5KUjISazuk7JyhKNEh8U3IS9tlIFHlRhPT202s2cQn7bev-yDfL2EUPj5aH-pMFm-akXmm4Al5FPI4aB6XNuvcJOQxXPyypLN337FjIY-RLwl5jJT_DgAA__-4Tq1U">