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

    <tr>
        <th>Summary</th>
        <td>
            GVNHoist: Split Parent when profitable to do so.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    GVNHoist currently bails out unless a value is fully anticipable at a dominator. It may be profitable to split the parents and create a common dominator for all the basic blocks that have a fully anticipable value. e.g.,
```
                      BB
 /       |     \
             /        |         \
           BB1(v) BB2(v)        BB3
```

If only BB1 and BB2 has `v`(for an instruction `I`). it might be profitable to create a common predecessor for BB1,BB2 and hoist `I` there.
```
                       BB
 /         \ 
                   BB0 (v)    \
 /       |             \
             /        |                 \
 BB1  BB2            BB3
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk8GOmzAQhp_GXEaLjAkkPnBYskq7l6pSpd4HY4JbYyN7yCpvX-FNN-0mW6lRFAdm_plf33gwRnN0Wjesaln1lOFCow_NaAL2hs6Ydb4_N5--f_nsTSRQSwjakT1Dh8ZG8AvB4qyOERBOaBcNJsKwWHsGdGSUmbGzGpAAofeTcUg-5PBMMOEZOg1z8IOhlEQe4mwNAY0aZlwbRUDXgwoaSQOC8tPk3bUQDD4AWpsUHUajoLNe_YxAIxKMeFpVt3aS0xx0fsyZ2DP-xPgjq_nlmx7h7qdtL1EmDpdXbLt_Pav9HeU17y3xo-S2LZjYnZiQ0Lbi99-3YHnX5uvv8wDe2fNaIgFrWwEjRmA1P62pYpdAOTAuUlgUGe_W4HMKyhwMwWSOI91O5D37OeheKx3jhX5yvV8bro3HdEsuldepBJ3_B957fBMs-FDVthz-YHUFezuhf8H_cFK3ohVyIvyXi_vjyfqm7GUpMdNNsS0qIYt6W2Vjs-M41Epses63ipe7qiikGCql-rqWYouZaQQXG15xKYpqU1b5Tm5UJ5TcDcO2k7JiG64nNDa39jTlPhwzE-OiG1nUdZVZ7LSNaauFcPoFUpAJsS55aFbNQ7ccI9twayLFaxUyZPXbxrPyEb6lpfyaFhJeRu3eXZHeQ_R5tgTbjERzZOUjEwcmDkdD49Llyk9MHNYGl-NhDv6HVsTEIdmKTByS7V8BAAD__91CQso">