<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJy1VNFumzAU_Rp4sUBgbAIPPDTtKlXaUyvttTLYgCcbI9skzb5-tkm6JG1XTdsI-Ab7-PjcY65bRQ_NAwCLYQbYkYFeCaH2fBpAp6QkEwVWgYFNTBPLwOPD023yDRBjmGzFwWGom6KVBELsJGgPlvmuqLiJsrsoO7ZCdCCRRHdjVNxpbrpdiXyHtdp1RHArI3jrAllDvwa6hm4N7GVmmks2WSKSHUgCTeJ-rLNKJy23JpF8cnw5rIBlxqZCnIt4mK7yOyVFL9NxywWgZgM3lmkQwRt3m3yNgBtvlp8EWmXHI434hfee9ZpIlsyKT76nVxqYmTs9jns_8m4EHQmOSyaVPoCeLMICumivi72wbrFcTem5_AhvQ1I_-Bxh51k1WjsbbzS8d_fA7bi0qdsz9-L34hiSWavvziL32nPBjIubKt8giN2_V0JYny8FjpfcrfHSAJ-DmS-RaXqhNf263ebPpRMHPrkiWLgHT-qZaa20eW7bS2ZB10gyvy5ybWXy_FXwCdbLXbpPX0BvA45srlj2RxbkR_PSsXjC-gNU4VEw-z3qrSufTCB5SOF9kDnlGRSWqHKw6xXqDy2sEl954F4J6r7Mp_CpXdJrwgM9DvagVcn7CkL2G_i_FAT6tb1SQCg98-AIxO-rfOt-Gbb1HyiOaVPQuqhJTBY7Kt3syTR0I5sGCONFi-aPK48bs4TSw0WWl_HYlBi1DNG8r6sNZjSjGcMdhiyvIKrLvo0FaZkwjSt6V-zx3y_JG5hBmOUZzmtcoDKt2hp1bVZgijDKMYpQxiThIvU8qdJDrJtA2S6DcYPCnW3m16A7MfkwMXZSaLkVrHk8HYHuxFcd8WcY-OLrOg5ymqDlJ_USxUs>53016</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Register Allocation Error
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    I  uses the following command to generate RISC-V assembly code from llvm bytecode:

llc -march=riscv64 -mattr=+m,+a,+f,+d,+c,+experimental-v -riscv-v-vector-bits-min=128 test.ll

In the following generated assembly code, the register **s1** is used as both general register and frame-pointer for spill, which causes memory fault during execution.

[test.zip](https://github.com/llvm/llvm-project/files/7817425/test.zip)

        mv      **s1**, sp
        ...

.LBB1_6:                                # %no_errors_bb
        ld      a0, 40(s11)
        fmv.w.x ft0, a7
        lw      a4, 16(a0)
        lw      a3, 20(a0)
        lw      **s1**, 0(a0)
        lw      a1, 4(a0)
        sd      a4, 648(**s1**)                     # 8-byte Folded Spill
        srai    a5, a4, 4
        sd      a3, 728(**s1**)                     # 8-byte Folded Spill
        srai    a3, a3, 4
        add     a4, a3, a5
        sd      **s1**, 616(**s1**)                     # 8-byte Folded Spill

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VNFumzAU_Rp4sUBgIMADD027SpX21Ep7rQw24MnGyDZJs6_ftUnaJG1XTdoI-Ab7cHzusa9bRQ_NA0KLYQbZkaFeCaH2fBpQp6QkE0VWoYFNTBPL0OPD0230AxFjmGzFATAUPtFKIiF2ErUHy1xXkN0EyV2QHFshOhRJorsxyO40N91uk7sOazV0BHgrA3wLgayhXwNdQ7cG9jIzzSWbLBHRDkWeJoIf66zSUcutiSSfgC_FFbLM2FiIcxEP01V-p6ToZTownQdqNnBjmUYBvoHbpGtE3Diz3EeoVXY80og3vPOs10SyaFZ8cj290sjMHPQA937k3Yg64h2XTCp9QD1ZhEV00U4Xe2HdYrma4nP5QbH1Sf3ic1CAZ9Vo7Wyc0fge7oHbcWljWDN4cWtxDNGs1U-wCF57LpiBWFZpmeMC_r0S4vp8KnS85G6Nlwa4HMx8iYzjC63x9-02fd6AOPTFFeAMnmJSz0xrpc1z214yC7pGkrh5c2grk6avgk-wXu7iffyCeutxpLxi2R9ZcjeaboDFEdafoDKHwsmfUe9d-eIDkvoUPgaZU55e4SavAHY9Q_2phVXkKg_dK0FhZz75rXZJrwn39IW3J1-VfKzAZ1_i_6XA06_tlQJC6ZkHR2Dxscr37m_8sv4DxSFtMlpnNQktt4I1j6fChnNMdcRVJvrmdmu4aNH8dRlyYxZfh0WWpJtwbCjripykJC2TrC2zrKJ9nnUlwXWSlG1fh4K0TJgGTgCo_JA3OME4SZMirYss38RVW-ddm2QFzYs8LfIgT5gkXMRu4ljpIdSN19Aug4FBAdmYt0E4_PgwMXbiJ4sdlW72ZBq6kU0DxqGX3Hi9vwGVx6_I">