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

    <tr>
        <th>Summary</th>
        <td>
            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>
    when using `llc -mtriple=riscv64 -mcpu=thrive-trigon ` to processing following code, all things works well.
`
define void @test1() "target-features"="-zfbfmin,-zvfbfmin,-zvfbfwma" {
entry:
  ret void
}
`
and generated a asm file contained following code line like this:
`.option arch, -zfbfmin, -zvfbfmin, -zvfbfwma`

However, when using llvm-mc to process the asm file generated above, i got a error
`error: can't disable zfbfmin extension; zvfbfwma extension requires zfbfmin extenion` at 
[RISCVAsmParser.cpp:](https://github.com/llvm/llvm-project/blob/13daf3b70c6e8991c846e8384de47c5e84a94480/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp#L3130)

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/eJzElM2O4zYMx5-GuRAJFPkzBx88mwYtUHSLzqJ32aJtdWTJleSkk6cvpMxMsoP20FNPUSyK_JH8k8J7NRqiBoonKI4bsYbJuuZ6vU7TpDedla_NZSKDq1dmRCiZ1j1u5-DUogmyo1O-P5c5bud-WSE7hsmpM22DU6M10R6DxcXZnnzyMFit7SWeeisJ-BcUWmOYlBk9Xqx78XghrXfAWigZsFbSoAzh2SqJk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