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

    <tr>
        <th>Summary</th>
        <td>
            [CodeGen][NewPM] Avoid function level global states in `TargetMachine`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:codegen
      </td>
    </tr>

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

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

<pre>
    Currently, some function level properties are passed by `TargetMachine`, by calling [`TargetMachine::resetTargetOptions()`](https://llvm.org/doxygen/classllvm_1_1TargetMachine.html#af0a50afebb9bed07d36be2bac4c6f729) before instruction selection. Now we are trying to port codegen pipeline to new pass manager, and this is not friendly to pass parallelization, we may move this part to a new analysis pass or something else and make it accessible to other codegen infrastructures (e.g. `TargetLowering`).
See also #27735 and #23546.
CC @aeubanks @arsenm 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU0_znDYM_TTmogkDNn-WA4fN_mZ7adLOtPeMDALcGJuxzG7pp--Y_bWZZHLC2E96epIeMpvZEfWi_ijqtwz3uPjQb7hRGBa0ZqBM-_Hob3sI5KI9hLwB-5Vg2t0QjXdg6UEWtuA3CtEQAwaCDZlpBH2AaIo_McwUP-GwGEeiKVIOfcCA1ho3Q-L-EaSuQl0DMcXX_W9b4mIhL0J2KUX9JuRliXHjhJV3Ie_WPtbch1nI--j_PmZyQt4Hi8zp5Uv5pfyOI1_iaoVUOBVYFziR1p2msWhH1WiSGodqaKZWdkJ2oGnygcA4jmF_6WaydJ5y-Oyf8KRTeAxH0hQ9bD5EGPxIMznYzEbWOEoPjp5nf2BFhzOF1A50I8TFMBgG5yNMwZAb7XEmStgNA1pL1vyDiTPFPAlWPGD1D3rFbhhiCsCTAh3ag89rZvDhHFtcUnVkmU7KFb8SmAg4DMRstD0L9HGh8H_pxk0BX7L3QAxCXiif82-D_dU_KRg3n5PtclG8ieL6BxGgZQ9CKtm2qj750o-qq-YddLuBqAqkXaP7yuc5MLkVsrFXY6c6zKgv27Kpmkvb1NnSF3qQpSQ9UIXq0k4XulBbF2M5lSUpwsz0spBVUUtVylpWdY5K11LpCXGc2qZDURW0orH5f-uSGead-k6VlzqzqMnyaQcpE0Ko63sjhJTJIqFP1x_0PrOoCms48rdU0UR7munmR_qFXFrT-uNnev7-SdRvcH14M_7onNl6jRY4YiQG437mmGwPtv9-22cTl13ng1_fV__982EL_i8aopD3UxgLeX9pe_Ty3wAAAP__uidPcg">