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

    <tr>
        <th>Summary</th>
        <td>
            [RISCV]Asm Parser report error when parsing option arch directives.
        </td>
    </tr>

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

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

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

<pre>
    Using llc to processing the file `llvm/test/CodeGen/RISCV/riscv-func-target-feature.ll` and it will generate a asm file.
and we using following llvm-mc to generate object file, it report error.
`llvm-mc --arch=riscv64 -mcpu=sifive-u74 riscv-func-target-feature.s -filetype=obj -o tmp.o`

`error: can't disable d extension; zcd extension requires d extension`

the root cause maybe in https://github.com/llvm/llvm-project/blob/13daf3b70c6e8991c846e8384de47c5e84a94480/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp#L465

the feature in NeedEmitStdOptionArgs should order in 'need relationship', if a need b, it should put a before b.
So i sort the NeedEmitStdOptionArgs by 'need relationship' like above, it works well.

Does somebody noticed this ?
Or is there a better solution ?

Thks.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2P3DYM_TWaC2HDluWPOfgw2amLAkUTdNPeZYkeKytbrijPdPfXF9JMmg3QHHoyYJF8j3yPlETmsiL2rP7A6vNB7mF2vn97e5vn2R5Gp1_7P8isF7BWQXCweaeQ0p8wI0zGIrCmsPa6MD4EpMD48OQ0_owr48Pvvzw__cn44A2pazbtq8qC9BcM2YQy7B5za1lTgFw1mAA3Yy1ccEUvA4IESUuCyFlxiiE3hD1hT85ad7vzui7Zkrj9m-jGL6hCymT8KRb2uDkfAL13PhZ7UI6JWSa9mll1ThwbAdmitp1VZzKTuWK2twJ-TJ8gizDhdUNWnd34BTIHYdlyx5oiAiWshMuqEyi5Mt4G0IbkaBE04N8BVzJuZdUHeFPvfoDHv3bjkb6L-lo1Tt87F0DJnRAW-ToimBXmEDZi1YnxgfHhYsK8j7lyUZ2HSKnxzbs4I8aH0bqR8aGstJyqsS1Ug93xWKpONNhVndAoWlVjJ-RRiK54V8fEvM9pHu-kTt8TLZ-8WQP6XG0b49Wvoqm_EX9ML_L9DVH_tJjwHPTHLRi3nvyFgGa3Ww3Oa_QxivF2RdTg0coYRLPZGG-TuhNISI_jQ-xH8rYHkDDi5DzCGFV_dmCAohEiif9GHl9_BAbWvCDI0V2_uurm_AvBDa3N772dHRKQWzAuDqwuGIUawmwIWDWw4vTRg6GI7jFxCwE9kLN7xHnEsOL0eX6h_KD7Sh-rozxgX7a1qMWxFOVh7qeirLAtda27Y3PkjewUH1vRlNPYdZMQB9PzgtdFV7RFI2pR5lxi3eoGixZr1U6KiQIXaWwepcydvxwM0Y59WXMhjgcrR7SUbgLnK94gvTLO44nwfTLQuF-IicIaCvStTDDBpmNyd0N9PtECn6Qn9N_tINxmXGGTPm2zS-OHuIegjUcVzBUpP-ze9v_bz4krRUffm7n2_J8AAAD__3_zn9k">