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

    <tr>
        <th>Summary</th>
        <td>
            [llvm-reduce] Add delta pass to simplify the structure of non-removed initializers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            llvm-tools,
            julialang
      </td>
    </tr>

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

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

<pre>
    Consider the llvm-reduce output in https://gist.github.com/Keno/a27add2aed10793b76d340639d0d5bd8 (which I manually reduced further to file #54634). The output contains two big global variables:
```
@jl_sysimg_gvars = constant [15411 x i64*] [i64* undef, i64* undef, ...
@jl_sysimg_fvars = constant [28283 x i64*] [i64* undef, i64* undef, ...
```
(for both arrays all but one of the array entries are non-undef). Both variables are semantic in our pass pipeline and recognized by one of the passes that was part of the pipeline we were reducing over, so the variable and its initializer were not removable. However, it would have been permissible and desirable to cut down the constant arrays to only the one non-undef entry. It should be possible to do this with a new delta pass that knows how to simplify the structure of constants.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVE1v2zAM_TX2hajhyHZiH3xIGxQrdt29kC3aVqdIhiTHy379KOWjXVHsMECAIJF6j3wk1Rlxbp-MdlKgBT8hKHU6PlgUS49gFj8vHqSGyfvZJcU-Yc-0Rul8Nko_LV3WmyPdfEdtaONsx4VgHMUm3zVFt9uKosy3RSNyUXWihoTV6yT7CV7gyPXClTrDhUzAsFgKgKIwMEiF5FtU5bYoE9Zk8GO6h9Mb7bnUDvxqoJMjjMp0XMGJW8k7hTHO_JDk-2SbX9flWOZv6tWdnTyOryO5O0iKQ8BznmsPSfW4qcrNBn6B3BLtPqkO4fJygEULHBL2BJ_PWZZ9QTB8ScBqVhf_T_ApIVYPxkJn_ATcWn52QIpCRyIZTXoNsaLRAqi9lUgOFkEb_XAFJ2kfw_O7eNHBIVXHyz6U3iwWZu4czHJGJQmXa0FF682o5W-qW3f-yBZcCcVP3MPK6RW3_m67IaxhEU8svdQjmBPakKkz0fEWTaSS3lEc0kuuiM9eXmrj6fXRnIJbBt_MilcISbxmUQImfkLoEDXMaI_SOXlDFOikjfjUaz2pJcyqI_G9VFc5yW409WiwhSTvykU9zxm8eHBTpOsoP3MloWciZCIdrDIUBzSuRKs8v2gZ5fmpzepgMmvwp56ZlRwuVM7bpfeLjareYnJZKtpCNEXDUy-9wpZa58O4hmbaC_EXzb9wQy5RQqrhB31duljVfh74D7MeKK_bw2zNG_aejqTvQqPHnsPMbtOp3XblpqybHjljuBNlNWzypmasx77iDDFVvEPlQhIJeeiJ6x6PJCudQh1pixTeGOXe794WRYFyPYar6pDKluWM5UWR58WmLquMY101Rcl3TVnnrChoKKmbpcoCWmbsmNo2AnfL6Mio6DNz70aSTY4ao7gBny9-MrYNH1wac2xjgn8AG5W8GA">