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

    <tr>
        <th>Summary</th>
        <td>
            Error from inline asm for missing target feature despite enabling target feature when using LTO
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            backend:RISC-V,
            LTO
      </td>
    </tr>

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

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

<pre>
    When compiling a file for LTO/ThinLTO, we ran into an issue where an inline assembly directive for compressed instruction gave an error, despite us setting the `march` string correctly. Note, this occurs when generating the bitcode output in the compile step, and not during the link. We also don't see any such error in the non-LTO cases. This still occurs at ToT (1d1432356e6) and back at least as far as c58bc24fcf678c55b0b. I haven't checked farther back in the commit history than Fuchsia's previous toolchain, but I think this is probably not a new behavior/bug.

I confirmed that `-target-feature +c` appears in the `cc1` command line.

I was able to reduce this down to just an `asm(c.ebreak)` statement. I've included the original file along w/ the reduced case, and reproducer script w/ a `-cc1` invocation.

This code come from Fuchsia and can be found here: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/utest/inspector/print_debug_info.cc;l=131?q=print_debug_info.cc&ss=fuchsia%2Ffuchsia

Failing bot: https://ci.chromium.org/ui/p/turquoise/builders/global.ci/minimal.riscv64-lto/b8757351392559542993/overview

[reproducer.zip](https://github.com/llvm/llvm-project/files/14131777/reproducer.zip)

This seems related to https://github.com/llvm/llvm-project/issues/67698, but I'm not totally sure. There were also some recent changes that tried to plumb these to the MC layer and I thought AsmParser, but I'm also unsure if these are related.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU-P27gP_TTKhRgjlmM7OeQwf34GBuhvu9gdbI-FLDO2OrLkilKC6adfUG5mOt1edi-xY1HkI_keqYjM6BCPor4T9cNGpTj5cDTWn3Exm94PL8dPEzrQfl6MNW4EBSdjEU4-wIenj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