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

    <tr>
        <th>Summary</th>
        <td>
            Backport "[RISCV] Fixing stack offset for RVV object with vararg in stack."
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V,
            release:backport
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          kito-cheng
      </td>
    </tr>
</table>

<pre>
    This bug is about the stack offset, RISC-V backend might generate wrong stack offset to corrupt the stack content if there is scalable vector object and callee-save vaarg objesct.

We hit this bug when compile spec2017 with auto-vectorization and cause wrong result, so I believe this should backport to LLVM 14 branch.

https://github.com/llvm/llvm-project/commit/690085c9b715af720ecbd1c009731ba5478cf493 Serialize some filed in RISCVMachineFunctionInfo into MIR YAML file make the test case reproduce-able.
https://github.com/llvm/llvm-project/commit/7a123890c946beb533c5f7ca460d676f494d5ab3 Add test
https://github.com/llvm/llvm-project/commit/9c5aedfbf53ee8ce75723dec88359403e813499f Fix 
https://github.com/llvm/llvm-project/commit/5286c7aef8b4486c991b13b65eac9dbf01cb51f6 Add missing lit.local.cfg
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE1v3CoU_TWeDRoLY2ObhRdpo0iRkk36NNVb8nGxaRgzApz09df3mmT02u6qSJYBX3zPOfdLBfPf9M_iElHbTHCRKmyZ5AVIylI_k2Btglyxz-Tp_svn44ko_AqrIWc3L5nMsEKUGchrDOv82z8kB6JDjNvlV386rBnWTJzdP0bYMZOWXioP5AV0DpEE9Q03RCIKWjzAMckXtEoZ52JMOtcVva3ozdv7K5DF7SjvOl4XWBHpfHHoNF1AM9oM5NXlhcgth-MbjvshswvrO86WriIipM0XySmQe6LAO0D44j0tYfOmBOESYtH48HB6JE1HVJSrXn7jteR8SVV7U7E7fGbE31SNvPDg_ct1OV5i2AXjEW1nt296QenItVBDw6UdGAWtTKMpFUPbKMm7YdS2Ey35AtFJ736gznAGYlGxIW4t2To9Sr24Fe62Ve9K71cb0IacH--fyL83jw_lPjnLZygpypAyhgIjEQFJmU3DcU9M_VE5g2xYOwqqRdcrULxtNbeDll1PTT_0qKQzXKqW3BhTWHwUUGguwVhleQswahj4wFoDehxbLjrawti0nRCW3Lnv5KNgnI29HiTYUXUdboVoVNOqnoPUwihLG614Y_ui7uxSclhl3uXaB6zvWtv5YKbWiFbIQ3bZw_TpWl8VYxX_VJJZ8dudrfuzzSx2zNPpdO2aUuUvMu69gnVQrtbo5rBFP_21RiS7Qdo1diMVh2WifOTKGiEtHwynmule7oUorZIda9gBOxl8mpA1gr4PC0R8mx67HOwrXCJ4wEJDy7WXitTbg5sYZYx2dKQDZZzXqhG0Z72RSrcDp7TqKJyl8_VOtQ5xPsSpsMbOT2j0LuX0v1FiuOcVoDBC_zgAlhCnZ4dzQOOcmA9F41QE_gTtUqgY">